index.ftl 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>企业管理</title>
  5. <#include "../../include/head-file.ftl">
  6. </head>
  7. <body>
  8. <div id="index" class="ms-index" v-cloak>
  9. <el-header class="ms-header" height="50px">
  10. <el-col :span=12>
  11. <@shiro.hasPermission name="tf:enterprise:save">
  12. <el-button type="primary" class="el-icon-plus" size="default" @click="save()">新增</el-button>
  13. </@shiro.hasPermission>
  14. <@shiro.hasPermission name="tf:enterprise:del">
  15. <el-button type="danger" class="el-icon-delete" size="default" @click="del(selectionList)" :disabled="!selectionList.length">删除</el-button>
  16. </@shiro.hasPermission>
  17. </el-col>
  18. </el-header>
  19. <div class="ms-search">
  20. <el-row>
  21. <el-form :model="form" ref="searchForm" label-width="120px" size="default">
  22. <el-row>
  23. <el-col :span=8>
  24. <!--企业名称-->
  25. <el-form-item label="企业名称" prop="enterpriseName">
  26. <el-input
  27. v-model="form.enterpriseName"
  28. :disabled="false"
  29. :readonly="false"
  30. :style="{width: '100%'}"
  31. :clearable="true"
  32. placeholder="请输入企业名称">
  33. </el-input>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span=8>
  37. <!--企业类型-->
  38. <el-form-item label="企业类型" prop="enterpriseType">
  39. <ms-dict v-model="form.enterpriseType"
  40. :style="{width: '100%'}"
  41. dict-type="企业管理-企业类型"
  42. :filterable="false"
  43. :disabled="false"
  44. :multiple="false" :clearable="true"
  45. placeholder="请选择企业类型">
  46. </ms-dict>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span=8>
  50. <!--品牌名-->
  51. <el-form-item label="品牌名" prop="enterpriseBrand">
  52. <el-input
  53. v-model="form.enterpriseBrand"
  54. :disabled="false"
  55. :readonly="false"
  56. :style="{width: '100%'}"
  57. :clearable="true"
  58. placeholder="请输入品牌名">
  59. </el-input>
  60. <div class="ms-form-tip">
  61. 多个品牌名,使用中英逗号分隔 </div>
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. <el-row>
  66. <el-col :span=8>
  67. <!--展位号-->
  68. <el-form-item label="展位号" prop="enterpriseBooth">
  69. <el-input
  70. v-model="form.enterpriseBooth"
  71. :disabled="false"
  72. :readonly="false"
  73. :style="{width: '100%'}"
  74. :clearable="true"
  75. placeholder="请输入展位号">
  76. </el-input>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span=8>
  80. <!--联系人-->
  81. <el-form-item label="联系人" prop="enterpriseContact">
  82. <el-input
  83. v-model="form.enterpriseContact"
  84. :disabled="false"
  85. :readonly="false"
  86. :style="{width: '100%'}"
  87. :clearable="true"
  88. placeholder="请输入联系人">
  89. </el-input>
  90. </el-form-item>
  91. </el-col>
  92. <el-col :span=8>
  93. <!--经营状态-->
  94. <el-form-item label="经营状态" prop="enterpriseOperatingStatus">
  95. <ms-dict v-model="form.enterpriseOperatingStatus"
  96. :style="{width: '100%'}"
  97. dict-type="企业管理-经营状态"
  98. :filterable="false"
  99. :disabled="false"
  100. :multiple="false" :clearable="true"
  101. placeholder="请选择经营状态">
  102. </ms-dict>
  103. </el-form-item>
  104. </el-col>
  105. </el-row>
  106. <el-row>
  107. <el-col :span=24 style="display: flex;justify-content: end;padding-right: 10px;">
  108. <el-button type="primary" class="el-icon-search" size="default" @click="currentPage=1;list(true)">搜索</el-button>
  109. <el-button @click="rest" class="el-icon-refresh" size="default">重置</el-button>
  110. <ms-search ref="search" @search="search" :search-json="searchJson" :search-key="historyKey"></ms-search>
  111. </el-col>
  112. </el-row>
  113. </el-form>
  114. </el-row>
  115. </div>
  116. <el-main class="ms-container">
  117. <el-table class="ms-table-pagination" v-loading="loading" ref="multipleTable" border :data="dataList" tooltip-effect="dark" @selection-change="handleSelectionChange">
  118. <template #empty>
  119. {{emptyText}}
  120. </template>
  121. <el-table-column type="selection" width="40" :selectable="isChecked"></el-table-column>
  122. <el-table-column label="企业名称" min-width="250" align="left" prop="enterpriseName">
  123. </el-table-column>
  124. <el-table-column label="企业类型" align="left" prop="enterpriseType" :formatter="enterpriseTypeFormat">
  125. </el-table-column>
  126. <el-table-column label="品牌名" min-width="100" align="left" prop="enterpriseBrand">
  127. </el-table-column>
  128. <el-table-column label="展位号" align="left" prop="enterpriseBooth">
  129. </el-table-column>
  130. <el-table-column label="访问量" align="right" prop="enterpriseVisits">
  131. </el-table-column>
  132. <el-table-column label="联系人" align="left" prop="enterpriseContact">
  133. </el-table-column>
  134. <el-table-column label="联系电话" align="left" prop="enterpriseTel">
  135. </el-table-column>
  136. <el-table-column label="企业地址" min-width="250" align="left" prop="enterpriseAddress">
  137. </el-table-column>
  138. <el-table-column label="入驻时间" min-width="200" align="center" prop="enterpriseEntryTime" >
  139. </el-table-column>
  140. <el-table-column label="经营状态" align="left" prop="enterpriseOperatingStatus" :formatter="enterpriseOperatingStatusFormat">
  141. </el-table-column>
  142. <el-table-column min-width="80" label="LOGO" align="left">
  143. <template #default="scope">
  144. <template v-if="scope.row.enterpriseLogo&&scope.row.enterpriseLogo !=''&&JSON.parse(scope.row.enterpriseLogo).length">
  145. <div class="block" v-for="src in JSON.parse(scope.row.enterpriseLogo)">
  146. <el-image
  147. :src="(!src.url.startsWith('http://') && !src.url.startsWith('https://')) ? ms.contextpath + src.url : src.url"
  148. :preview-teleported=true
  149. style="width: 50px;height: 50px;line-height: 50px;font-size: 30px">
  150. <template #error>
  151. <template class="image-slot">
  152. <i class="el-icon-picture-outline"></i>
  153. </template>
  154. </template>
  155. </el-image>
  156. </div>
  157. </template>
  158. </template>
  159. </el-table-column>
  160. <el-table-column min-width="180" align="center" label="创建时间" prop="createDate"></el-table-column>
  161. <el-table-column label="操作" width="180" align="center" fixed="right">
  162. <template #default="scope">
  163. <@shiro.hasPermission name="tf:enterpriseProducts:view">
  164. <el-link type="primary" :underline="false" @click="openlist(scope.row.id,scope.row.enterpriseName)">产品管理</el-link>
  165. </@shiro.hasPermission>
  166. <@shiro.hasPermission name="tf:enterprise:update">
  167. <el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
  168. </@shiro.hasPermission>
  169. <@shiro.hasPermission name="tf:enterprise:del">
  170. <el-link type="primary" :underline="false" @click="del([scope.row])" v-if="scope.row.del!=3">删除</el-link>
  171. </@shiro.hasPermission>
  172. </template>
  173. </el-table-column>
  174. </el-table>
  175. <el-pagination
  176. background
  177. :page-sizes="[10,20,30,40,50,100]"
  178. layout="total, sizes, prev, pager, next, jumper"
  179. :current-page="currentPage"
  180. :page-size="pageSize"
  181. :total="total"
  182. class="ms-pagination"
  183. @current-change='currentChange'
  184. @size-change="sizeChange">
  185. </el-pagination>
  186. </el-main>
  187. </div>
  188. </body>
  189. </html>
  190. <script>
  191. var indexVue = new _Vue({
  192. el: '#index',
  193. provide() {
  194. return {
  195. searchParent: this //筛选使用
  196. };
  197. },
  198. data:function() {
  199. return {
  200. searchJson:[
  201. {
  202. "isSearch": "true",
  203. "action": "and",
  204. "field": "ENTERPRISE_NAME",
  205. "el": "eq",
  206. "model": "enterpriseName",
  207. "name": "企业名称",
  208. "type": "input"
  209. },
  210. {
  211. "isSearch": "true",
  212. "action": "and",
  213. "field": "ENTERPRISE_TYPE",
  214. "el": "eq",
  215. "model": "enterpriseType",
  216. "name": "企业类型",
  217. "key": "dictValue",
  218. "title": "dictLabel",
  219. "type": "select",
  220. "multiple": "false"
  221. }, {
  222. "isSearch": "true",
  223. "action": "and",
  224. "field": "ENTERPRISE_BRAND",
  225. "el": "eq",
  226. "model": "enterpriseBrand",
  227. "name": "品牌名",
  228. "type": "input"
  229. },
  230. {
  231. "isSearch": "true",
  232. "action": "and",
  233. "field": "ENTERPRISE_BOOTH",
  234. "el": "eq",
  235. "model": "enterpriseBooth",
  236. "name": "展位号",
  237. "type": "input"
  238. },
  239. {
  240. "isSearch": "",
  241. "action": "and",
  242. "field": "ENTERPRISE_VISITS",
  243. "el": "eq",
  244. "model": "enterpriseVisits",
  245. "name": "访问量",
  246. "type": "number"
  247. },
  248. {
  249. "isSearch": "true",
  250. "action": "and",
  251. "field": "ENTERPRISE_CONTACT",
  252. "el": "eq",
  253. "model": "enterpriseContact",
  254. "name": "联系人",
  255. "type": "input"
  256. },
  257. {
  258. "isSearch": "",
  259. "action": "and",
  260. "field": "ENTERPRISE_TEL",
  261. "el": "eq",
  262. "model": "enterpriseTel",
  263. "name": "联系电话",
  264. "type": "input"
  265. },
  266. {
  267. "isSearch": "",
  268. "action": "and",
  269. "field": "ENTERPRISE_ADDRESS",
  270. "el": "eq",
  271. "model": "enterpriseAddress",
  272. "name": "企业地址",
  273. "type": "input"
  274. },
  275. {
  276. "action": "and",
  277. "field": "ENTERPRISE_ENTRY_TIME",
  278. "model": "enterpriseEntryTime",
  279. "el": "gt",
  280. "fmt": "YYYY-MM-DD",
  281. "name": "入驻时间",
  282. "type": "date"
  283. },
  284. {
  285. "isSearch": "true",
  286. "action": "and",
  287. "field": "ENTERPRISE_OPERATING_STATUS",
  288. "el": "eq",
  289. "model": "enterpriseOperatingStatus",
  290. "name": "经营状态",
  291. "key": "dictValue",
  292. "title": "dictLabel",
  293. "type": "select",
  294. "multiple": "false"
  295. }, {
  296. "action":"and",
  297. "field": "ENTERPRISE_LOGO",
  298. "el": "empty",
  299. "model": "enterpriseLogo",
  300. "name": "LOGO",
  301. "type": "imgupload"
  302. },
  303. ],
  304. dataList: [], //企业管理列表
  305. selectionList:[],//企业管理列表选中
  306. total: 0, //总记录数量
  307. pageSize: 10, //页面数量
  308. currentPage:1, //初始页
  309. manager: ms.manager,
  310. loading: true,//加载状态
  311. emptyText:'',//提示文字
  312. // 企业类型
  313. enterpriseTypeOptions:[],
  314. // 经营状态
  315. enterpriseOperatingStatusOptions:[],
  316. //搜索表单
  317. form:{
  318. sqlWhere:null
  319. },
  320. //历史记录参数
  321. historyKey: "tf_enterprise_history"
  322. }
  323. },
  324. watch:{
  325. disabled: {
  326. handler(newVal) {
  327. if (newVal === true) {
  328. ms.editorConfig.readonly = true;
  329. } else {
  330. ms.editorConfig.readonly = false;
  331. }
  332. },
  333. immediate: true
  334. }
  335. },
  336. methods:{
  337. isChecked: function(row) {
  338. if(row.del == 3) {
  339. return false;
  340. }
  341. return true;
  342. },
  343. //查询列表
  344. list: function(isSearch) {
  345. var that = this;
  346. var data = {}; //搜索参数
  347. that.loading = true;
  348. var page={
  349. pageNo: that.currentPage,
  350. pageSize : that.pageSize
  351. }
  352. var form = JSON.parse(JSON.stringify(that.form))
  353. if(isSearch) {
  354. //删除空字符串
  355. for (var key in form){
  356. if(form[key] === undefined || form[key] === null){
  357. delete form[key]
  358. }
  359. }
  360. form.sqlWhere ? data = Object.assign({}, {sqlWhere: form.sqlWhere}, page) : data = Object.assign({}, form, page)
  361. } else {
  362. data = page;
  363. }
  364. sessionStorage.setItem(that.historyKey,JSON.stringify({form: form, page: page}));
  365. ms.http.post(ms.manager+"/tf/enterprise/list.do",data).then(
  366. function(res) {
  367. if (!res.result||res.data.total <= 0) {
  368. that.emptyText ="暂无数据"
  369. that.dataList = [];
  370. that.total = 0;
  371. } else {
  372. that.emptyText = '';
  373. that.total = res.data.total;
  374. that.dataList = res.data.rows;
  375. }
  376. that.loading = false;
  377. }).catch(function(err) {
  378. that.loading = false;
  379. console.log(err);
  380. });
  381. },
  382. //企业管理列表选中
  383. handleSelectionChange:function(val){
  384. this.selectionList = val;
  385. },
  386. //删除
  387. del: function(row){
  388. var that = this;
  389. that.$confirm("此操作将永久删除所选内容, 是否继续", "提示", {
  390. confirmButtonText: "确认",
  391. cancelButtonText: "取消",
  392. type: 'warning'
  393. }).then(function() {
  394. ms.http.post(ms.manager+"/tf/enterprise/delete.do", row.length?row:[row],{
  395. headers: {
  396. 'Content-Type': 'application/json'
  397. }
  398. }).then(
  399. function(res){
  400. if (res.result) {
  401. that.$notify({
  402. title:'成功',
  403. type: 'success',
  404. message:"删除成功"
  405. });
  406. //删除成功,刷新列表
  407. that.list();
  408. }else {
  409. that.$notify({
  410. title: "错误",
  411. message: res.msg,
  412. type: 'warning'
  413. });
  414. }
  415. });
  416. }).catch(function(err) {
  417. //删除如果用户取消会抛出异常,所以需要catch一下
  418. console.log(err)
  419. });
  420. },
  421. //新增
  422. save:function(id){
  423. if(id){
  424. ms.util.openSystemUrl("/tf/enterprise/form.do?id="+id);
  425. }else {
  426. ms.util.openSystemUrl("/tf/enterprise/form.do");
  427. }
  428. },
  429. //产品管理
  430. openlist:function(id,name){
  431. window.parent.indexVue.open({
  432. id: "E-"+id,
  433. modelTitle: "产品管理-"+name,
  434. modelUrl: "/tf/enterpriseProducts/index.do?id=" + id,
  435. })
  436. },
  437. //pageSize改变时会触发
  438. sizeChange:function(pagesize) {
  439. this.loading = true;
  440. this.pageSize = pagesize;
  441. this.list(true);
  442. },
  443. //currentPage改变时会触发
  444. currentChange:function(currentPage) {
  445. this.loading = true;
  446. this.currentPage = currentPage;
  447. this.list(true);
  448. },
  449. search:function(data){
  450. this.form.sqlWhere = JSON.stringify(data);
  451. this.list(true);
  452. },
  453. //重置表单
  454. rest:function(){
  455. this.currentPage = 1;
  456. this.form = {
  457. sqlWhere:null
  458. };
  459. this.$refs.searchForm.resetFields();
  460. this.list(true);
  461. },
  462. //企业类型 列表格式化
  463. enterpriseTypeFormat:function(row, column, cellValue, index){
  464. var value="";
  465. if(cellValue){
  466. var data = this.enterpriseTypeOptions.find(function(value){
  467. return value.dictValue==cellValue;
  468. })
  469. if(data&&data.dictLabel){
  470. value = data.dictLabel;
  471. }
  472. }
  473. return value;
  474. },
  475. //获取enterpriseType数据源
  476. enterpriseTypeOptionsGet:function() {
  477. var that = this;
  478. ms.http.get(ms.base+'/mdiy/dict/list.do', {dictType:'企业管理-企业类型',pageSize:99999}).then(function (res) {
  479. that.enterpriseTypeOptions = res.data.rows;
  480. }).catch(function (err) {
  481. console.log(err);
  482. });
  483. },
  484. //入驻时间日期格式化
  485. enterpriseEntryTimeFormat:function(row, column, cellValue, index){
  486. return ms.util.date.fmt(new Date(row.ENTERPRISE_ENTRY_TIME),'YYYY-MM-DD');
  487. },
  488. //经营状态 列表格式化
  489. enterpriseOperatingStatusFormat:function(row, column, cellValue, index){
  490. var value="";
  491. if(cellValue){
  492. var data = this.enterpriseOperatingStatusOptions.find(function(value){
  493. return value.dictValue==cellValue;
  494. })
  495. if(data&&data.dictLabel){
  496. value = data.dictLabel;
  497. }
  498. }
  499. return value;
  500. },
  501. //获取enterpriseOperatingStatus数据源
  502. enterpriseOperatingStatusOptionsGet:function() {
  503. var that = this;
  504. ms.http.get(ms.base+'/mdiy/dict/list.do', {dictType:'企业管理-经营状态',pageSize:99999}).then(function (res) {
  505. that.enterpriseOperatingStatusOptions = res.data.rows;
  506. }).catch(function (err) {
  507. console.log(err);
  508. });
  509. },
  510. // enterpriseLogo删除
  511. enterpriseLogoHandleRemove: function (file, files) {
  512. var index = -1;
  513. index = this.form.enterpriseLogo.findIndex(function (text) {
  514. return text.uid == file.uid;
  515. });
  516. if (index != -1) {
  517. this.form.enterpriseLogo.splice(index, 1);
  518. }
  519. },
  520. //enterpriseLogo上传超过限制
  521. enterpriseLogoHandleExceed: function (files, fileList) {
  522. this.$notify({
  523. title: '失败',
  524. message: '当前最多上传1个文件',
  525. type: 'warning'
  526. });
  527. },
  528. //enterpriseLogo预览
  529. enterpriseLogoHandlePreview: function (file){
  530. window.open(file.url);
  531. },
  532. //enterpriseLogo上传前
  533. enterpriseLogoBeforeUpload: function (file) {
  534. var type = file.type;
  535. if (type) {
  536. var isImage = type.startsWith('image/');
  537. if (!isImage) {
  538. this.$notify({
  539. title: '提示',
  540. message: '请上传图片类型文件',
  541. type: 'warning'
  542. });
  543. }
  544. return isImage;
  545. }
  546. return false;
  547. },
  548. //enterpriseLogo上传成功
  549. enterpriseLogoSuccess: function (response, file, fileList) {
  550. if (response.result) {
  551. if(!response.data.startsWith("http://") && !response.data.startsWith("https://")) {
  552. file.url = ms.contextpath + response.data;
  553. }else{
  554. file.url = response.data;
  555. }
  556. this.form.enterpriseLogo.push({
  557. url: response.data,
  558. name: file.name,
  559. uid: file.uid
  560. });
  561. } else {
  562. // 移除上传图片
  563. var index = fileList.indexOf(file);
  564. if (index > -1) {
  565. fileList.splice(index, 1);
  566. }
  567. this.$notify({
  568. title: '失败',
  569. message: response.msg,
  570. type: 'warning'
  571. });
  572. }
  573. },
  574. //enterpriseLogo上传失败
  575. enterpriseLogoError: function (response, file, fileList) {
  576. response = JSON.parse(response.message);
  577. this.$notify({
  578. title: '失败',
  579. message: response.msg,
  580. type: 'warning'
  581. });
  582. },
  583. },
  584. mounted:function(){
  585. var that = this;
  586. //如果存在历史参数,恢复页面结果
  587. if(sessionStorage.getItem(this.historyKey) && ms.util.getParameter("isBack") == 'true') {
  588. var _history = JSON.parse(sessionStorage.getItem(this.historyKey))
  589. this.form = _history.form;
  590. this.total = parseInt(_history.total);
  591. this.currentPage = parseInt(_history.page.pageNo);
  592. this.pageSize = parseInt(_history.page.pageSize);
  593. }
  594. this.list(true);
  595. },
  596. created:function(){
  597. var that = this;
  598. //加载企业类型 数据
  599. this.enterpriseTypeOptionsGet();
  600. //加载经营状态 数据
  601. this.enterpriseOperatingStatusOptionsGet();
  602. }
  603. })
  604. </script>
  605. <style scoped>
  606. #index .ms-container {
  607. height: calc(100vh - 141px);
  608. }
  609. </style>