You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

608 lines
17 KiB

  1. <template>
  2. <div class="customer-css">
  3. <!-- 查询时间和产品 -->
  4. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 5px;">
  5. <el-form-item :label=labels.customerId>
  6. <el-input v-model="pageData.customerId" style="width: 120px"></el-input>
  7. </el-form-item>
  8. <el-form-item :label=labels.labelNo>
  9. <el-input v-model="pageData.labelNo" style="width: 120px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label=labels.labelType>
  12. <el-input v-model="pageData.labelType" style="width: 120px"></el-input>
  13. </el-form-item>
  14. <el-form-item :label=labels.labelName>
  15. <el-input v-model="pageData.labelName" style="width: 120px" ></el-input>
  16. </el-form-item>
  17. <el-form-item style="margin-top: 16px;">
  18. <el-button type="primary" @click="refreshPageTables()" class="customer-bun-mid"
  19. style="margin-left: 10px; margin-bottom: 5px;">{{ buttons.searchButton }}
  20. </el-button>
  21. </el-form-item>
  22. <el-form-item style="margin-top: 16px;">
  23. <el-button type="primary" :disabled="authAdd" @click="addLabelSettingModal()" class="customer-bun-mid"
  24. style="margin-left: 10px; margin-bottom: 5px;">{{ buttons.addButton }}
  25. </el-button>
  26. </el-form-item>
  27. </el-form>
  28. <!-- 标签列表数据 -->
  29. <el-main style="margin-left: -20px; margin-top: -20px; width: 104%;">
  30. <el-table @row-click="setCurrentRow"
  31. :height="height"
  32. highlight-current-row
  33. :data="labelArrays"
  34. border
  35. v-loading="dataListLoading"
  36. style="width: 100%;">
  37. <el-table-column
  38. v-for="(item,index) in columnList" :key="index"
  39. :sortable="item.columnSortable"
  40. :prop="item.columnProp"
  41. :header-align="item.headerAlign"
  42. :show-overflow-tooltip="item.showOverflowTooltip"
  43. :align="item.align"
  44. :fixed="item.fixed==''?false:item.fixed"
  45. :width="item.columnWidth"
  46. :label="item.columnLabel">
  47. <template slot-scope="scope">
  48. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  49. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  50. style="width: 100px; height: 80px"/></span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column
  54. fixed="left"
  55. header-align="center"
  56. align="center"
  57. width="100"
  58. :label=labels.operationLabel>
  59. <template slot-scope="scope">
  60. <a class="customer-a" v-if="!authEdit" @click="editLabelSettingModal(scope.row)">{{ labels.editLabel }}</a>
  61. <a class="customer-a" v-if="!authDelete" @click="deleteLabelSettingConfirm(scope.row)">{{ labels.deleteLabel }}</a>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. </el-main>
  66. <!-- 动态列 -->
  67. <column v-if="showDefault" ref="column" @refreshData="getTableUserColumn" v-drag></column>
  68. <!-- 新增或者修改的modal -->
  69. <comAddUpdateLabel ref="comAddUpdateLabel" @refreshPageTables="refreshPageTables" v-drag></comAddUpdateLabel>
  70. </div>
  71. </template>
  72. <script>
  73. import {
  74. getLabelSettingList,
  75. deleteLabelSetting,
  76. } from '@/api/labelSetting/customer_label_setting.js';
  77. /*引入組件*/
  78. import comAddUpdateLabel from "./com_add_update_customer_label";/*新增或者修改的組件*/
  79. /* 动态表头 */
  80. import {
  81. saveTableDefaultList,
  82. getTableDefaultListLanguage,
  83. getTableUserListLanguage,
  84. removerDefault,
  85. removerUser
  86. } from '@/api/table.js'
  87. import {
  88. searchSysLanguagePackList,
  89. searchSysLanguageParam,
  90. searchFunctionButtonList,
  91. saveButtonList,
  92. searchSysLanguage,
  93. searchLanguageListByLanguageCode,
  94. saveSysLanguageOne,
  95. searchPageLanguageData,
  96. removerLanguage,
  97. saveSysLanguageList
  98. } from "@/api/sysLanguage.js";
  99. var functionId = '100008003';
  100. export default {
  101. data() {
  102. return {
  103. height: 800,
  104. authEdit: false,
  105. authAdd: false,
  106. authDelete: false,
  107. menuId: this.$route.meta.menuId,
  108. menuShow: false,
  109. showDefault: false,
  110. pageData: {
  111. site: this.$store.state.user.site,
  112. username: this.$store.state.user.name,
  113. customerId: '',
  114. labelNo: '',
  115. labelName: '',
  116. labelType: '',
  117. searchFlag: 'Y'
  118. },
  119. currentRow: {},
  120. labelArrays: [],
  121. dataListLoading: false,
  122. columnList: [
  123. {
  124. userId: this.$store.state.user.name,
  125. functionId: 100008003,
  126. serialNumber: '100008003LabelLabelType',
  127. tableId: '100008003Label',
  128. tableName: '客户标签自定义列表',
  129. columnProp: 'labelType',
  130. headerAlign: 'center',
  131. align: 'center',
  132. columnLabel: '标签类型',
  133. columnWidth: 100,
  134. columnHidden: false,
  135. columnImage: false,
  136. columnSortable: true,
  137. sortLv: 0,
  138. status: true,
  139. fixed: ''
  140. }, {
  141. userId: this.$store.state.user.name,
  142. functionId: 100008003,
  143. serialNumber: '100008003LabelCustomerId',
  144. tableId: '100008003Label',
  145. tableName: '客户标签自定义列表',
  146. columnProp: 'customerId',
  147. headerAlign: 'center',
  148. align: 'center',
  149. columnLabel: '客户编码',
  150. columnWidth: 100,
  151. columnHidden: false,
  152. columnImage: false,
  153. columnSortable: true,
  154. sortLv: 0,
  155. status: true,
  156. fixed: ''
  157. }, {
  158. userId: this.$store.state.user.name,
  159. functionId: 100008003,
  160. serialNumber: '100008003LabelCustomerDesc',
  161. tableId: '100008003Label',
  162. tableName: '客户标签自定义列表',
  163. columnProp: 'customerDesc',
  164. headerAlign: 'center',
  165. align: 'center',
  166. columnLabel: '客户名称',
  167. columnWidth: 100,
  168. columnHidden: false,
  169. columnImage: false,
  170. columnSortable: true,
  171. sortLv: 0,
  172. status: true,
  173. fixed: ''
  174. }, {
  175. userId: this.$store.state.user.name,
  176. functionId: 100008003,
  177. serialNumber: '100008003LabelLabelNo',
  178. tableId: '100008003Label',
  179. tableName: '客户标签自定义列表',
  180. columnProp: 'labelNo',
  181. headerAlign: 'center',
  182. align: 'center',
  183. columnLabel: '标签编号',
  184. columnWidth: 160,
  185. columnHidden: false,
  186. columnImage: false,
  187. columnSortable: true,
  188. sortLv: 0,
  189. status: true,
  190. fixed: ''
  191. }, {
  192. userId: this.$store.state.user.name,
  193. functionId: 100008003,
  194. serialNumber: '100008003LabelLabelName',
  195. tableId: '100008003Label',
  196. tableName: '客户标签自定义列表',
  197. columnProp: 'labelName',
  198. headerAlign: 'center',
  199. align: 'center',
  200. columnLabel: '报表文件名',
  201. columnWidth: 220,
  202. columnHidden: false,
  203. columnImage: false,
  204. columnSortable: true,
  205. sortLv: 0,
  206. status: true,
  207. fixed: ''
  208. }, {
  209. userId: this.$store.state.user.name,
  210. functionId: 100008003,
  211. serialNumber: '100008003LabelLabelClass',
  212. tableId: '100008003Label',
  213. tableName: '客户标签自定义列表',
  214. columnProp: 'labelClass',
  215. headerAlign: 'center',
  216. align: 'left',
  217. columnLabel: '标签种类',
  218. columnWidth: 140,
  219. columnHidden: false,
  220. columnImage: false,
  221. columnSortable: false,
  222. sortLv: 0,
  223. status: true,
  224. fixed: ''
  225. }, {
  226. userId: this.$store.state.user.name,
  227. functionId: 100008003,
  228. serialNumber: '100008003LabelSite',
  229. tableId: '100008003Label',
  230. tableName: '客户标签自定义列表',
  231. columnProp: 'site',
  232. headerAlign: 'center',
  233. align: 'left',
  234. columnLabel: '工厂编号',
  235. columnWidth: 60,
  236. columnHidden: false,
  237. columnImage: false,
  238. columnSortable: false,
  239. sortLv: 0,
  240. status: true,
  241. fixed: ''
  242. }, {
  243. userId: this.$store.state.user.name,
  244. functionId: 100008003,
  245. serialNumber: '100008003LabelSubLabelFlag',
  246. tableId: '100008003Label',
  247. tableName: '客户标签自定义列表',
  248. columnProp: 'subLabelFlag',
  249. headerAlign: 'center',
  250. align: 'left',
  251. columnLabel: '子报表',
  252. columnWidth: 60,
  253. columnHidden: false,
  254. columnImage: false,
  255. columnSortable: false,
  256. sortLv: 0,
  257. status: true,
  258. fixed: ''
  259. }, {
  260. userId: this.$store.state.user.name,
  261. functionId: 100008003,
  262. serialNumber: '100008003LabelParentLabelNo',
  263. tableId: '100008003Label',
  264. tableName: '客户标签自定义列表',
  265. columnProp: 'parentLabelNo',
  266. headerAlign: 'center',
  267. align: 'left',
  268. columnLabel: '上级标签编号',
  269. columnWidth: 120,
  270. columnHidden: false,
  271. columnImage: false,
  272. columnSortable: false,
  273. sortLv: 0,
  274. status: true,
  275. fixed: ''
  276. }, {
  277. userId: this.$store.state.user.name,
  278. functionId: 100008003,
  279. serialNumber: '100008003LabelRemark',
  280. tableId: '100008003Label',
  281. tableName: '客户标签自定义列表',
  282. columnProp: 'remark',
  283. headerAlign: 'center',
  284. align: 'left',
  285. columnLabel: '备注',
  286. columnWidth: 240,
  287. columnHidden: false,
  288. columnImage: false,
  289. columnSortable: false,
  290. sortLv: 0,
  291. status: true,
  292. fixed: ''
  293. },
  294. ],
  295. queryTable: {
  296. userId: this.$store.state.user.name,
  297. functionId: this.$route.meta.menuId,
  298. tableId: '100008003Label',
  299. languageCode: this.$i18n.locale
  300. },
  301. // 用户table 查询参数
  302. queryTableUser: {
  303. userId: this.$store.state.user.name,
  304. functionId: this.$route.meta.menuId,
  305. tableId: '100008003Label',
  306. status: true,
  307. languageCode: this.$i18n.locale
  308. },
  309. // 用户table 配置集合
  310. userColumnList: [],
  311. buttons: {
  312. searchButton: '查询',
  313. addButton: '新增',
  314. },
  315. queryButton: {
  316. functionId: functionId,
  317. table_id: '*',
  318. languageCode: this.$i18n.locale,
  319. objectType: 'button'
  320. },
  321. labels: {
  322. customerId: '客户编码',
  323. labelNo: '标签编号:',
  324. labelType: '标签类型:',
  325. labelName: '报表文件名:',
  326. operationLabel: '操作',
  327. editLabel: '编辑',
  328. deleteLabel: '删除',
  329. sureDeleteThisRecord: '确定要删除该记录吗?',
  330. tipsLabel: '提示',
  331. confirmLabel: '确定',
  332. cancelLabel: '取消',
  333. },
  334. queryLabel: {
  335. functionId: functionId,
  336. table_id: '*',
  337. languageCode: this.$i18n.locale,
  338. objectType: 'label'
  339. },
  340. }
  341. },
  342. components: {
  343. comAddUpdateLabel,/*标签新增或者修改的组件*/
  344. },
  345. mounted() {
  346. this.$nextTick(() => {
  347. this.height = window.innerHeight - 165;
  348. })
  349. },
  350. methods: {
  351. /* 刷新页面table */
  352. refreshPageTables() {
  353. this.currentRow = {};
  354. //重置是否查询
  355. this.pageData.searchFlag = 'Y';
  356. this.refreshLabelSettingList();
  357. },
  358. // 获取当前列表的信息
  359. refreshLabelSettingList() {
  360. // 查询当前页面的参数
  361. getLabelSettingList(this.pageData).then(({data}) => {
  362. // 设置查询数据
  363. this.labelArrays = data.rows;
  364. })
  365. },
  366. /*新增标签定义的modal*/
  367. addLabelSettingModal(){
  368. let currentData = {
  369. site: this.$store.state.user.site,
  370. username: this.$store.state.user.name,
  371. labelNo: '',
  372. labelName: '',
  373. labelType: '',
  374. labelClass: '',
  375. subLabelFlag: 'N',
  376. parentLabelNo: '*',
  377. customerId: '',
  378. remark: '',
  379. addFlag: 'Y'
  380. };
  381. //打开组件 去做新增业务
  382. this.$nextTick(() => {
  383. this.$refs.comAddUpdateLabel.init(currentData);
  384. })
  385. },
  386. /*修改标签定义的modal*/
  387. editLabelSettingModal(row){
  388. let currentData = row;
  389. currentData.addFlag = 'N';
  390. //打开组件 去做修改业务
  391. this.$nextTick(() => {
  392. this.$refs.comAddUpdateLabel.init(currentData);
  393. })
  394. },
  395. /*删除标签*/
  396. deleteLabelSettingConfirm(row){
  397. this.$confirm(this.labels.sureDeleteThisRecord, this.labels.tipsLabel, {
  398. confirmButtonText: this.labels.confirmLabel,
  399. cancelButtonText: this.labels.cancelLabel,
  400. type: 'warning'
  401. }).then(() => {
  402. deleteLabelSetting(row).then(({data}) => {
  403. if (data && data.code == 200) {
  404. this.refreshPageTables();
  405. this.$message.success(data.msg);
  406. } else {
  407. this.$message.error(data.msg);
  408. }
  409. });
  410. });
  411. },
  412. /* 设置选中行的参数 */
  413. setCurrentRow(row, column, event) {
  414. this.currentRow = JSON.parse(JSON.stringify(row))
  415. },
  416. // 打开页面设置
  417. userSetting() {
  418. this.visible = true
  419. let queryTable = {
  420. userId: this.$store.state.user.name,
  421. functionId: this.$route.meta.menuId,
  422. tableId: '100008003Label',
  423. languageCode: this.$i18n.locale
  424. }
  425. this.$nextTick(() => {
  426. this.$refs.column.init(queryTable)
  427. })
  428. },
  429. // 获取 用户保存的 格式列
  430. getTableUserColumn() {
  431. getTableUserListLanguage(this.queryTableUser).then(({data}) => {
  432. if (data && data.code == 0 && data.rows.length > 0) {
  433. // this.columnList = []
  434. this.columnList = data.rows
  435. } else {
  436. this.getColumnList()
  437. }
  438. })
  439. },
  440. // 获取 tableDefault 列
  441. getColumnList() {
  442. getTableDefaultListLanguage(this.queryTable).then(({data}) => {
  443. if (data && data.code == 0 && data.rows.length > 0) {
  444. // this.showDefault = false
  445. this.columnList = data.rows
  446. } else {
  447. // this.showDefault = true
  448. }
  449. })
  450. },
  451. //获取按钮的权限数据
  452. getButtonAuthData(){
  453. let updateFlag = this.isAuth(this.menuId+":revise");
  454. let fullControFlag = this.isAuth(this.menuId+":fullContro");
  455. let deleteFlag = this.isAuth(this.menuId+":remove");
  456. //处理页面的权限数据
  457. this.authEdit = !updateFlag && !fullControFlag;
  458. this.authAdd = !fullControFlag;
  459. this.authDelete = !deleteFlag;
  460. },
  461. //获取多语言的信息
  462. getMultiLanguageList() {
  463. //首先查询当前按钮的多语言
  464. searchFunctionButtonList(this.queryButton).then(({data}) => {
  465. if (data && data.code == 0 ) {
  466. this.buttons = data.data
  467. } else {
  468. // saveButtonList(this.buttonList).then(({data}) => {
  469. // })
  470. }
  471. });
  472. //其次查询当前标签的多语言
  473. searchFunctionButtonList(this.queryLabel).then(({data}) => {
  474. if (data && data.code == 0 ) {
  475. this.labels = data.data
  476. } else {
  477. // saveButtonList(this.buttonList).then(({data}) => {
  478. // })
  479. }
  480. });
  481. },
  482. },
  483. created() {
  484. // 不查询
  485. this.refreshLabelSettingList();
  486. // 获取动态表头的信息
  487. this.getTableUserColumn()
  488. //获取按钮的权限
  489. this.getButtonAuthData();
  490. //刷新多语言的信息
  491. this.getMultiLanguageList();
  492. }
  493. }
  494. </script>
  495. <style>
  496. .el-textarea__inner {
  497. padding: 5px 5px;
  498. }
  499. </style>
  500. <!--当前页面的标签样式-->
  501. <style scoped lang="scss">
  502. /*针对el-card*/
  503. .customer-card .el-form-item__content {
  504. margin-top: -15px;
  505. }
  506. .customer-card .el-form-item {
  507. height: 22px;
  508. }
  509. .customer-border .el-form-item__content {
  510. margin-top: -30px;
  511. }
  512. /*全局年与日类型 宽度*/
  513. div.el-time-width {
  514. width: 110px !important;
  515. }
  516. /* 全局时间右边框*/
  517. .customer-css input.el-input__inner {
  518. height: 22px !important;
  519. padding-right: 0px !important;
  520. }
  521. /* 控制el-card标签的数据*/
  522. div.customer-el-card {
  523. margin-left: 110px;
  524. margin-top: -15px;
  525. height: 20px;
  526. width: 60px;
  527. }
  528. /* 颜色控制 */
  529. div.customer-el-card-pink {
  530. background: #FF00FF;
  531. }
  532. div.customer-el-card-orange {
  533. background: #FFD700;
  534. }
  535. div.customer-el-card-blue {
  536. background: #0000CD;
  537. }
  538. /*清掉样式*/
  539. .el-radio + .el-radio {
  540. margin-left: 0px;
  541. }
  542. /*当前按钮的通用样式*/
  543. .customer-css .customer-bun-mid {
  544. width: 65px;
  545. text-align: center;
  546. }
  547. /*当前按钮的通用样式*/
  548. .customer-css .el-button--medium {
  549. padding: 5px 5px;
  550. }
  551. /*添加主菜单和明细菜单的样式*/
  552. .customer-css .customer-dropdown .el-button--primary {
  553. padding: 2px;
  554. font-size: 12px;
  555. }
  556. .el-dropdown-menu--medium .el-dropdown-menu__item {
  557. line-height: 18px;
  558. padding: 0 17px;
  559. font-size: 12px;
  560. }
  561. hr {
  562. margin-top: 0px;
  563. }
  564. /*控制上下间距*/
  565. </style>