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.

1885 lines
59 KiB

9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- <div>-->
  4. <!-- <span @click="favoriteFunction()">-->
  5. <!-- <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg" ></icon-svg>-->
  6. <!-- </span>-->
  7. <!-- </div>-->
  8. <el-form :inline="true" label-position="top">
  9. <el-form-item :label="inputLabel.headerInput.label1">
  10. <el-input style="width: 100px;" v-model="queryHeaderData.wareHouseId" ></el-input>
  11. </el-form-item>
  12. <el-form-item :label="inputLabel.headerInput.label2">
  13. <el-input style="width: 100px;" v-model="queryHeaderData.wareHouseName" ></el-input>
  14. </el-form-item>
  15. <el-form-item :label="inputLabel.headerInput.label4">
  16. <el-select v-model="queryHeaderData.active" placeholder="请选择" style="width: 100px;">
  17. <el-option label="全部" value=""></el-option>
  18. <el-option
  19. v-for="item in selectList.select1"
  20. :key="item.value"
  21. :label="item.label"
  22. :value="item.value">
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item style="margin-top: 20px;">
  27. <el-button @click="getDataList('Y')" type="primary">{{buttons.search}}</el-button>
  28. </el-form-item>
  29. <el-form-item style="margin-top: 20px;">
  30. <el-button @click="initModel()" type="primary">{{buttons.add}}</el-button>
  31. <!-- <el-button @click="userSetting" type="primary">{{ buttons.settingTable}}</el-button>-->
  32. <download-excel
  33. :fields="fields()"
  34. :data="exportData"
  35. type="xls"
  36. :name="exportName"
  37. :header="exportHeader"
  38. :footer="exportFooter"
  39. :defaultValue="exportDefaultValue"
  40. :fetch="createExportData"
  41. :before-generate="startDownload"
  42. :before-finish="finishDownload"
  43. worksheet="导出信息"
  44. class="el-button el-button--primary el-button--medium">
  45. {{buttons.download}}
  46. </download-excel>
  47. <el-button v-if="isAuth(':prd:delete')" type="danger" @click="deleteHandle()"
  48. :disabled="dataListSelections.length <= 0">{{ buttons.deleteList}}
  49. </el-button>
  50. </el-form-item>
  51. </el-form>
  52. <el-table
  53. id="commmon"
  54. :height="height"
  55. :data="dataList"
  56. border
  57. v-loading="dataListLoading"
  58. @selection-change="selectionChangeHandle"
  59. style="width: 100%;">
  60. <el-table-column
  61. v-for="(item,index) in columnList" :key="index"
  62. :sortable="item.columnSortable"
  63. :prop="item.columnProp"
  64. :header-align="item.headerAlign"
  65. :show-overflow-tooltip="item.showOverflowTooltip"
  66. :align="item.align"
  67. :fixed="item.fixed==''?false:item.fixed"
  68. :min-width="item.columnWidth"
  69. :label="item.columnLabel">
  70. <template slot-scope="scope">
  71. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  72. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column
  76. fixed="right"
  77. header-align="center"
  78. align="center"
  79. min-width="180"
  80. :label="buttons.cz">
  81. <template slot-scope="scope">
  82. <el-link style="cursor: pointer" @click="initModel(scope.row)">{{buttons.edit}} | </el-link>
  83. <el-link style="cursor: pointer" @click="delHeaderData(scope.row)">{{buttons.delete}} | </el-link>
  84. <el-link style="cursor: pointer" @click="openStorageConfigDialog(scope.row)">仓储策略配置 | </el-link>
  85. <el-link style="cursor: pointer" @click="openAccessAuthDialog(scope.row)">权限授权</el-link>
  86. </template>
  87. </el-table-column>
  88. </el-table>
  89. <column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
  90. <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag :title="inputLabel.headerInput.label5" :visible.sync="setUp.reviewFlag" width="325px">
  91. <el-form :inline="true" label-position="top">
  92. <el-form-item :label="inputLabel.headerInput.label1">
  93. <el-input style="width: 130px;" :readonly = "setUp.readonlyFlag" onkeyup="this.value = this.value.toUpperCase()" v-model="saveHeaderData.wareHouseId"></el-input>
  94. </el-form-item>
  95. <el-form-item :label="inputLabel.headerInput.label2">
  96. <el-input style="width: 130px;" v-model="saveHeaderData.wareHouseName"></el-input>
  97. </el-form-item>
  98. </el-form>
  99. <el-form :inline="true" label-position="top">
  100. <el-form-item :label="inputLabel.headerInput.label3">
  101. <el-select v-model="saveHeaderData.wareHouseTypeDb" placeholder="请选择" style="width: 130px;">
  102. <el-option
  103. v-for="item in selectList.select2"
  104. :key="item.value"
  105. :label="item.label"
  106. :value="item.value">
  107. </el-option>
  108. </el-select>
  109. </el-form-item>
  110. <el-form-item :label="inputLabel.headerInput.label4">
  111. <el-select v-model="saveHeaderData.active" placeholder="请选择" style="width: 130px;">
  112. <el-option
  113. v-for="item in selectList.select1"
  114. :key="item.value"
  115. :label="item.label"
  116. :value="item.value">
  117. </el-option>
  118. </el-select>
  119. </el-form-item>
  120. </el-form>
  121. <span slot="footer" class="dialog-footer">
  122. <el-button @click="setUp.reviewFlag = false">取消</el-button>
  123. <el-button type="primary" :disabled="setUp.saveButton" @click="saveHeaderFunction()">确定</el-button>
  124. </span>
  125. </el-dialog>
  126. <!-- 仓储策略配置对话框 -->
  127. <el-dialog
  128. title="仓储策略配置"
  129. :close-on-click-modal="false"
  130. v-drag
  131. :visible.sync="storageConfigDialogVisible"
  132. width="1100px"
  133. custom-class="config-dialog">
  134. <!-- 查询区域 -->
  135. <div class="search-section">
  136. <el-form :inline="true" size="small">
  137. <el-form-item label="参数代码">
  138. <el-input
  139. v-model="configQuery.configCode"
  140. placeholder="请输入参数代码"
  141. clearable
  142. @clear="searchAvailableConfigs"
  143. @keyup.enter.native="searchAvailableConfigs"
  144. style="width: 150px">
  145. </el-input>
  146. </el-form-item>
  147. <el-form-item label="参数名称">
  148. <el-input
  149. v-model="configQuery.configName"
  150. placeholder="请输入参数名称"
  151. clearable
  152. @clear="searchAvailableConfigs"
  153. @keyup.enter.native="searchAvailableConfigs"
  154. style="width: 150px">
  155. </el-input>
  156. </el-form-item>
  157. <el-form-item>
  158. <el-button type="primary" icon="el-icon-search" @click="searchAvailableConfigs" size="small">查询</el-button>
  159. <el-button icon="el-icon-refresh" @click="resetConfigQuery" size="small">重置</el-button>
  160. </el-form-item>
  161. </el-form>
  162. </div>
  163. <div class="item-operation-content">
  164. <!-- 可选策略 -->
  165. <div class="item-panel available-panel">
  166. <div class="panel-header">
  167. <i class="el-icon-s-unfold"></i>
  168. <span class="panel-title">可选策略</span>
  169. <span class="item-count">({{ availableConfigList.length }})</span>
  170. </div>
  171. <el-table
  172. height="420px"
  173. :data="availableConfigList"
  174. ref="availableConfigTable"
  175. @row-click="availableConfigClickRow"
  176. @selection-change="availableConfigSelectionChange"
  177. highlight-current-row
  178. class="operation-table"
  179. :header-cell-style="{background: '#f5f7fa', color: '#606266', fontWeight: '500'}">
  180. <el-table-column
  181. type="selection"
  182. width="45"
  183. align="center">
  184. </el-table-column>
  185. <el-table-column
  186. prop="configType"
  187. headerAlign= "center"
  188. align="center"
  189. width="100"
  190. label="参数类型">
  191. </el-table-column>
  192. <el-table-column
  193. prop="configCode"
  194. headerAlign= "center"
  195. align="left"
  196. width="120"
  197. label="参数代码">
  198. </el-table-column>
  199. <el-table-column
  200. prop="configName"
  201. headerAlign= "center"
  202. align="left"
  203. min-width="150"
  204. show-overflow-tooltip
  205. label="参数名称">
  206. </el-table-column>
  207. <el-table-column
  208. prop="description"
  209. headerAlign= "center"
  210. align="left"
  211. min-width="200"
  212. show-overflow-tooltip
  213. label="详细说明">
  214. </el-table-column>
  215. </el-table>
  216. </div>
  217. <!-- 操作按钮 -->
  218. <div class="operation-buttons">
  219. <el-tooltip content="添加选中策略" placement="left">
  220. <el-button
  221. type="primary"
  222. icon="el-icon-d-arrow-right"
  223. circle
  224. @click="addStorageConfig"
  225. :disabled="!availableConfigSelections || availableConfigSelections.length === 0">
  226. </el-button>
  227. </el-tooltip>
  228. <el-tooltip content="移除选中策略" placement="right">
  229. <el-button
  230. type="danger"
  231. icon="el-icon-d-arrow-left"
  232. circle
  233. @click="removeStorageConfig"
  234. :disabled="!selectedConfigSelections || selectedConfigSelections.length === 0">
  235. </el-button>
  236. </el-tooltip>
  237. </div>
  238. <!-- 已配置策略 -->
  239. <div class="item-panel selected-panel">
  240. <div class="panel-header">
  241. <i class="el-icon-s-check"></i>
  242. <span class="panel-title">已配置策略</span>
  243. <span class="item-count">({{ selectedConfigList.length }})</span>
  244. </div>
  245. <el-table
  246. height="420px"
  247. :data="selectedConfigList"
  248. ref="selectedConfigTable"
  249. @row-click="selectedConfigClickRow"
  250. @selection-change="selectedConfigSelectionChange"
  251. highlight-current-row
  252. class="operation-table"
  253. :header-cell-style="{background: '#f5f7fa', color: '#606266', fontWeight: '500'}">
  254. <el-table-column
  255. type="selection"
  256. width="45"
  257. align="center">
  258. </el-table-column>
  259. <el-table-column
  260. prop="configCode"
  261. headerAlign= "center"
  262. align="left"
  263. width="120"
  264. label="参数代码">
  265. </el-table-column>
  266. <el-table-column
  267. prop="configName"
  268. headerAlign= "center"
  269. align="left"
  270. min-width="200"
  271. show-overflow-tooltip
  272. label="参数名称">
  273. </el-table-column>
  274. </el-table>
  275. </div>
  276. </div>
  277. <!-- 底部按钮 -->
  278. <div slot="footer" class="dialog-footer">
  279. <el-button @click="storageConfigDialogVisible = false" size="small" style="width: 80px;">关闭</el-button>
  280. </div>
  281. </el-dialog>
  282. <!-- 权限授权对话框 -->
  283. <el-dialog
  284. title="权限授权"
  285. :close-on-click-modal="false"
  286. v-drag
  287. :visible.sync="accessAuthDialogVisible"
  288. width="1000px"
  289. custom-class="config-dialog">
  290. <!-- 查询区域 -->
  291. <div class="search-section">
  292. <el-form :inline="true" size="small">
  293. <el-form-item label="用户编码">
  294. <el-input
  295. v-model="userQuery.username"
  296. placeholder="请输入用户编码"
  297. clearable
  298. @clear="searchAvailableUsers"
  299. @keyup.enter.native="searchAvailableUsers"
  300. style="width: 150px">
  301. </el-input>
  302. </el-form-item>
  303. <el-form-item label="用户名称">
  304. <el-input
  305. v-model="userQuery.userDisplay"
  306. placeholder="请输入用户名称"
  307. clearable
  308. @clear="searchAvailableUsers"
  309. @keyup.enter.native="searchAvailableUsers"
  310. style="width: 150px">
  311. </el-input>
  312. </el-form-item>
  313. <el-form-item>
  314. <el-button type="primary" icon="el-icon-search" @click="searchAvailableUsers" size="small">查询</el-button>
  315. <el-button icon="el-icon-refresh" @click="resetUserQuery" size="small">重置</el-button>
  316. </el-form-item>
  317. </el-form>
  318. </div>
  319. <div class="item-operation-content">
  320. <!-- 可选用户 -->
  321. <div class="item-panel auth-panel">
  322. <div class="panel-header">
  323. <i class="el-icon-user"></i>
  324. <span class="panel-title">可选用户</span>
  325. <span class="item-count">({{ availableUserList.length }})</span>
  326. </div>
  327. <el-table
  328. height="420px"
  329. :data="availableUserList"
  330. ref="availableUserTable"
  331. @row-click="availableUserClickRow"
  332. @selection-change="availableUserSelectionChange"
  333. highlight-current-row
  334. class="operation-table"
  335. :header-cell-style="{background: '#f5f7fa', color: '#606266', fontWeight: '500'}">
  336. <el-table-column
  337. type="selection"
  338. width="45"
  339. align="center">
  340. </el-table-column>
  341. <el-table-column
  342. prop="username"
  343. headerAlign= "center"
  344. align="left"
  345. min-width="100"
  346. label="用户编码">
  347. </el-table-column>
  348. <el-table-column
  349. prop="userDisplay"
  350. headerAlign= "center"
  351. align="left"
  352. min-width="200"
  353. show-overflow-tooltip
  354. label="用户名称">
  355. </el-table-column>
  356. </el-table>
  357. </div>
  358. <!-- 操作按钮 -->
  359. <div class="operation-buttons">
  360. <el-tooltip content="添加选中用户" placement="left">
  361. <el-button
  362. type="primary"
  363. icon="el-icon-d-arrow-right"
  364. circle
  365. @click="addAccessAuth"
  366. :disabled="!availableUserSelections || availableUserSelections.length === 0">
  367. </el-button>
  368. </el-tooltip>
  369. <el-tooltip content="移除选中用户" placement="right">
  370. <el-button
  371. type="danger"
  372. icon="el-icon-d-arrow-left"
  373. circle
  374. @click="removeAccessAuth"
  375. :disabled="!selectedUserSelections || selectedUserSelections.length === 0">
  376. </el-button>
  377. </el-tooltip>
  378. </div>
  379. <!-- 已授权用户 -->
  380. <div class="item-panel auth-panel">
  381. <div class="panel-header">
  382. <i class="el-icon-s-check"></i>
  383. <span class="panel-title">已授权用户</span>
  384. <span class="item-count">({{ selectedUserList.length }})</span>
  385. </div>
  386. <el-table
  387. height="420px"
  388. :data="selectedUserList"
  389. ref="selectedUserTable"
  390. @row-click="selectedUserClickRow"
  391. @selection-change="selectedUserSelectionChange"
  392. highlight-current-row
  393. class="operation-table"
  394. :header-cell-style="{background: '#f5f7fa', color: '#606266', fontWeight: '500'}">
  395. <el-table-column
  396. type="selection"
  397. width="45"
  398. align="center">
  399. </el-table-column>
  400. <el-table-column
  401. prop="userid"
  402. headerAlign= "center"
  403. align="left"
  404. min-width="100"
  405. label="用户编码">
  406. </el-table-column>
  407. <el-table-column
  408. prop="userName"
  409. headerAlign= "center"
  410. align="left"
  411. min-width="200"
  412. show-overflow-tooltip
  413. label="用户名称">
  414. </el-table-column>
  415. </el-table>
  416. </div>
  417. </div>
  418. <!-- 底部按钮 -->
  419. <div slot="footer" class="dialog-footer">
  420. <el-button @click="accessAuthDialogVisible = false" size="small" style="width: 80px;">关闭</el-button>
  421. </div>
  422. </el-dialog>
  423. </div>
  424. </template>
  425. <script>
  426. import column from "../common/column";
  427. import {
  428. searchSysLanguagePackList,
  429. searchSysLanguageParam,
  430. searchFunctionButtonList,
  431. saveButtonList,
  432. searchSysLanguage,
  433. searchLanguageListByLanguageCode,
  434. saveSysLanguageOne
  435. } from "@/api/sysLanguage.js"
  436. import getLodop from '@/utils/LodopFuncs.js'
  437. import {
  438. saveTableDefaultList,
  439. saveTableUser,
  440. getTableDefaultListLanguage,
  441. getTableUserListLanguage,
  442. removerDefault,
  443. removerUser
  444. } from "@/api/table.js"
  445. import {
  446. userFavoriteList,
  447. saveUserFavorite,
  448. removeUserFavorite,
  449. } from '@/api/userFavorite.js'
  450. import {
  451. getWarehouseList,
  452. saveWarehouse,
  453. delWarehouse,
  454. getWareHouseTypeList,
  455. getStorageZoneConfigList,
  456. getWarehouseStorageConfigList,
  457. saveWarehouseStorageConfig,
  458. deleteWarehouseStorageConfig,
  459. getUserList,
  460. getAccessWarehouseList,
  461. saveAccessWarehouse,
  462. deleteAccessWarehouse,
  463. } from '@/api/warehouse/warehouse.js'
  464. export default {
  465. components: {
  466. column
  467. },
  468. data() {
  469. return {
  470. saveHeaderData :{
  471. id : 0,
  472. wareHouseId : '',
  473. wareHouseName : '',
  474. wareHouseType : '',
  475. active : '',
  476. wareHouseTypeDb : '',
  477. },
  478. queryHeaderData : {
  479. site : this.$store.state.user.site,
  480. wareHouseId : '',
  481. wareHouseName : '',
  482. wareHouseType : '',
  483. active : '',
  484. },
  485. setUp: {
  486. reviewFlag: false,
  487. saveButton: false,
  488. reviewFlag1 : false,
  489. readonlyFlag : false,
  490. },
  491. inputLabel :{
  492. headerInput : {
  493. label1 : '仓库编码',
  494. label2 : '仓库名称',
  495. label3 : '仓库类型',
  496. label4 : '使用状态',
  497. label5 : '仓库信息',
  498. },
  499. },
  500. selectList: {
  501. select1: [{
  502. value: 'Y',
  503. label: '启用'
  504. }, {
  505. value: 'N',
  506. label: '禁用'
  507. }],
  508. select2: [],
  509. },
  510. site : this.$store.state.user.site,
  511. userName : this.$store.state.user.name,
  512. // table高度
  513. height:450,
  514. // 是否收藏
  515. favorite: false,
  516. addLanguage: false,
  517. functionId: this.$route.meta.menuId,
  518. tableId: this.$route.meta.menuId + 'WAHO01',
  519. value1: true,
  520. visible: false,
  521. showDefault: true,
  522. // 默认table 查询参数
  523. queryTable: {
  524. functionId: this.$route.meta.menuId,
  525. tableId: this.$route.meta.menuId + 'WAHO01',
  526. languageCode: this.$i18n.locale
  527. },
  528. // 用户table 查询参数
  529. queryTableUser: {
  530. userId: this.$store.state.user.name,
  531. functionId: this.$route.meta.menuId,
  532. tableId: this.$route.meta.menuId + 'WAHO01',
  533. status: true,
  534. languageCode: this.$i18n.locale
  535. },
  536. // 语言词典查询参数
  537. querySysLanguageParam: {
  538. languageCode: this.$i18n.locale
  539. },
  540. // 语言词典集合
  541. sysLanguageParams: [],
  542. // 用户table 配置集合
  543. userColumnList: [],
  544. // 展示列集
  545. columnList: [
  546. {
  547. userId: this.$store.state.user.name,
  548. serialNumber: 'wareHouse2501WareHouseId',
  549. tableId: this.$route.meta.menuId + 'WAHO01',
  550. tableName: "wareHouseTable",
  551. columnProp: "wareHouseId",
  552. headerAlign: "center",
  553. align: "center",
  554. columnLabel: "仓库编码",
  555. columnHidden: false,
  556. columnImage: false,
  557. columnSortable: false,
  558. sortLv: 0,
  559. status: true,
  560. fixed: '',
  561. columnWidth : 100,
  562. },
  563. {
  564. userId: this.$store.state.user.name,
  565. serialNumber: 'wareHouse2501WareHouseName',
  566. tableId: this.$route.meta.menuId + 'WAHO01',
  567. tableName: "wareHouseTable",
  568. columnProp: "wareHouseName",
  569. headerAlign: "center",
  570. align: "left",
  571. columnLabel: "仓库名称",
  572. columnHidden: false,
  573. columnImage: false,
  574. columnSortable: false,
  575. sortLv: 0,
  576. status: true,
  577. fixed: '',
  578. columnWidth : 200,
  579. },
  580. {
  581. userId: this.$store.state.user.name,
  582. serialNumber: 'wareHouse2501WareHouseType',
  583. tableId: this.$route.meta.menuId + 'WAHO01',
  584. tableName: "wareHouseTable",
  585. columnProp: "wareHouseTypeDb",
  586. headerAlign: "center",
  587. align: "center",
  588. columnLabel: "库房编码",
  589. columnHidden: false,
  590. columnImage: false,
  591. columnSortable: false,
  592. sortLv: 0,
  593. status: true,
  594. fixed: '',
  595. columnWidth : 80,
  596. },
  597. {
  598. userId: this.$store.state.user.name,
  599. serialNumber: 'wareHouse2501WareHouseTypeDb',
  600. tableId: this.$route.meta.menuId + 'WAHO01',
  601. tableName: "wareHouseTable",
  602. columnProp: "wareHouseType",
  603. headerAlign: "center",
  604. align: "center",
  605. columnLabel: "库房类型",
  606. columnHidden: false,
  607. columnImage: false,
  608. columnSortable: false,
  609. sortLv: 0,
  610. status: true,
  611. fixed: '',
  612. columnWidth : 120,
  613. },
  614. /* {
  615. userId: this.$store.state.user.name,
  616. functionId: this.$route.meta.menuId,
  617. serialNumber: 'wareHouse2501Keeper',
  618. tableId: this.$route.meta.menuId + 'WAHO01',
  619. tableName: "wareHouseTable",
  620. columnProp: "keeper",
  621. headerAlign: "center",
  622. align: "center",
  623. columnLabel: "管理人",
  624. columnHidden: false,
  625. columnImage: false,
  626. columnSortable: false,
  627. sortLv: 0,
  628. status: true,
  629. fixed: '',
  630. },
  631. {
  632. userId: this.$store.state.user.name,
  633. functionId: this.$route.meta.menuId,
  634. serialNumber: 'wareHouse2501CompanyId',
  635. tableId: this.$route.meta.menuId + 'WAHO01',
  636. tableName: "wareHouseTable",
  637. columnProp: "companyId",
  638. headerAlign: "center",
  639. align: "center",
  640. columnLabel: "公司编码",
  641. columnHidden: false,
  642. columnImage: false,
  643. columnSortable: false,
  644. sortLv: 0,
  645. status: true,
  646. fixed: '',
  647. },*/
  648. {
  649. userId: this.$store.state.user.name,
  650. serialNumber: 'wareHouse2501StrActive',
  651. tableId: this.$route.meta.menuId + 'WAHO01',
  652. tableName: "wareHouseTable",
  653. columnProp: "strActive",
  654. headerAlign: "center",
  655. align: "center",
  656. columnLabel: "状态",
  657. columnHidden: false,
  658. columnImage: false,
  659. columnSortable: false,
  660. sortLv: 0,
  661. status: true,
  662. fixed: '',
  663. columnWidth : 80,
  664. },
  665. ],
  666. // 展示列集
  667. columnList1: [
  668. // {
  669. // userId: this.$store.state.user.name,
  670. // functionId: this.$route.meta.menuId,
  671. // tableId: "common1002",
  672. // tableName: "commonLanguage",
  673. // columnProp: "functionId",
  674. // headerAlign: "center",
  675. // align: "center",
  676. // columnLabel: "功能编码",
  677. // columnHidden: false,
  678. // columnImage: false,
  679. // columnSortable: false,
  680. // sortLv: 0,
  681. // status: true,
  682. // fixed: false
  683. // },
  684. // {
  685. // userId: this.$store.state.user.name,
  686. // functionId: this.$route.meta.menuId,
  687. // tableId: "common1002",
  688. // tableName: "commonLanguage",
  689. // columnProp: "objectId",
  690. // headerAlign: "center",
  691. // align: "center",
  692. // columnLabel: "序列化编码",
  693. // columnHidden: false,
  694. // columnImage: false,
  695. // columnSortable: false,
  696. // sortLv: 0,
  697. // status: true,
  698. // fixed: '',
  699. // },
  700. // {
  701. // userId: this.$store.state.user.name,
  702. // functionId: this.$route.meta.menuId,
  703. // tableId: "common1002",
  704. // tableName: "commonLanguage",
  705. // columnProp: "objectType",
  706. // headerAlign: "center",
  707. // align: "center",
  708. // columnLabel: "类型",
  709. // columnHidden: false,
  710. // columnImage: false,
  711. // columnSortable: false,
  712. // sortLv: 0,
  713. // status: true,
  714. // fixed: '',
  715. // },
  716. // {
  717. // userId: this.$store.state.user.name,
  718. // functionId: this.$route.meta.menuId,
  719. // tableId: "common1002",
  720. // tableName: "commonLanguage",
  721. // columnProp: "languageValue",
  722. // headerAlign: "center",
  723. // align: "center",
  724. // columnLabel: "语言值",
  725. // columnHidden: false,
  726. // columnImage: false,
  727. // columnSortable: false,
  728. // sortLv: 0,
  729. // status: true,
  730. // fixed: '',
  731. // },
  732. // {
  733. // userId: this.$store.state.user.name,
  734. // functionId: this.$route.meta.menuId,
  735. // tableId: "common1002",
  736. // tableName: "commonLanguage",
  737. // columnProp: "languageCode",
  738. // headerAlign: "center",
  739. // align: "center",
  740. // columnLabel: "语言编码",
  741. // columnHidden: false,
  742. // columnImage: false,
  743. // columnSortable: false,
  744. // sortLv: 0,
  745. // status: true,
  746. // fixed: '',
  747. // }
  748. ],
  749. // 数据集
  750. dataList: [],
  751. queryButton: {
  752. functionId: this.$route.meta.menuId,
  753. tableId: this.$route.meta.menuId + 'WAHO01',
  754. languageCode: this.$i18n.locale,
  755. objectType: 'button'
  756. },
  757. buttons: {
  758. add: '新增',
  759. edit: '编辑',
  760. delete: '删除',
  761. deleteList: '批量删除',
  762. cz: '操作',
  763. search: '查询',
  764. download: '导出',
  765. settingTable: '设置列表',
  766. defaultTable: '设置默认配置'
  767. },
  768. // 导出 start
  769. exportData: [],
  770. exportName: "页面功能语言",
  771. exportHeader: ["页面功能语言"],
  772. exportFooter: [],
  773. exportDefaultValue: "",
  774. // 导出 end
  775. buttonList: [
  776. {
  777. languageValue: '新增',
  778. objectId: 'add',
  779. objectType: "button",
  780. tableId: this.$route.meta.menuId + 'WAHO01',
  781. },
  782. {
  783. languageValue: '编辑',
  784. objectId: 'edit',
  785. objectType: "button",
  786. tableId: this.$route.meta.menuId + 'WAHO01',
  787. },
  788. {
  789. languageValue: '删除',
  790. objectId: 'delete',
  791. objectType: "button",
  792. tableId: this.$route.meta.menuId + 'WAHO01',
  793. },
  794. // {
  795. //
  796. // languageValue: '批量删除',
  797. // objectId: 'deleteList',
  798. // objectType: "button",
  799. // tableId: this.$route.meta.menuId + 'WAHO01',
  800. // },
  801. {
  802. languageValue: '操作',
  803. objectId: 'cz',
  804. objectType: "button",
  805. tableId: this.$route.meta.menuId + 'WAHO01',
  806. },
  807. {
  808. languageValue: '查询',
  809. objectId: 'search',
  810. objectType: "button",
  811. tableId: this.$route.meta.menuId + 'WAHO01',
  812. },
  813. {
  814. languageValue: '导出',
  815. objectId: 'download',
  816. objectType: "button",
  817. tableId: this.$route.meta.menuId + 'WAHO01',
  818. },
  819. {
  820. languageValue: '设置列表',
  821. objectId: 'settingTable',
  822. objectType: "button",
  823. tableId: this.$route.meta.menuId + 'WAHO01',
  824. },
  825. {
  826. languageValue: '设置默认配置',
  827. objectId: 'defaultTable',
  828. objectType: "button",
  829. tableId: this.$route.meta.menuId + 'WAHO01',
  830. }
  831. ],
  832. languageList: [],
  833. languageColumnList: [],
  834. languageDataList: [],
  835. queryLanguage: {},
  836. // 数据集条件
  837. querySysLanguagePack: {
  838. functionId: '',
  839. page: 1,
  840. limit: 1,
  841. languageValue: '',
  842. objectType: '',
  843. objectId: ''
  844. },
  845. // 分页
  846. pageIndex: 1,
  847. pageSize: 20,
  848. totalPage: 0,
  849. dataListLoading: false,
  850. dataListSelections: [],
  851. addOrUpdateVisible: false,
  852. // 仓储策略配置相关
  853. storageConfigDialogVisible: false,
  854. currentWarehouse: null,
  855. availableConfigList: [],
  856. availableConfigListAll: [], // 保存所有可选策略
  857. selectedConfigList: [],
  858. availableConfigSelections: [],
  859. selectedConfigSelections: [],
  860. configQuery: {
  861. configCode: '',
  862. configName: ''
  863. },
  864. // 权限授权相关
  865. accessAuthDialogVisible: false,
  866. availableUserList: [],
  867. availableUserListAll: [], // 保存所有可选用户
  868. selectedUserList: [],
  869. availableUserSelections: [],
  870. selectedUserSelections: [],
  871. userQuery: {
  872. username: '',
  873. userDisplay: ''
  874. }
  875. }
  876. },
  877. mounted() {
  878. this.$nextTick(()=>{
  879. this.height = window.innerHeight - 170;
  880. })
  881. },
  882. activated() {
  883. this.getTblBaseList()
  884. this.getDataList()
  885. this.getLanguageList()
  886. },
  887. methods: {
  888. getTblBaseList(){
  889. let jsonDate = {
  890. site : this.site,
  891. type : 'WareHouseType'
  892. }
  893. this.selectList.select2 = []
  894. getWareHouseTypeList(jsonDate).then(({data}) =>{
  895. let list = data.list
  896. this.selectList.select2 = list.map(item =>{
  897. let resultData = {
  898. value: item.baseData,
  899. label : item.baseDesc,
  900. }
  901. return resultData
  902. })
  903. })
  904. },
  905. delHeaderData(row){
  906. this.$confirm(`确定删除该仓库及库位?`, '操作提示', {
  907. confirmButtonText: '确定',
  908. cancelButtonText: '取消',
  909. type: 'warning'
  910. }).then(() => {
  911. let jsonData ={
  912. site : row.site,
  913. wareHouseId : row.wareHouseId,
  914. }
  915. delWarehouse(jsonData).then(({data}) =>{
  916. if(data.code == 0){
  917. this.$message.success(data.msg)
  918. this.getDataList()
  919. }else {
  920. this.$alert(data.msg, '操作提示', {
  921. confirmButtonText: '确定',
  922. callback: action => {
  923. }
  924. });
  925. }
  926. })
  927. })
  928. },
  929. saveHeaderFunction(){
  930. this.setUp.saveButton = true
  931. if(this.saveHeaderData.wareHouseId == ''){
  932. this.$alert("请输入库房编码!", '操作提示', {
  933. confirmButtonText: '确定',
  934. callback: action => {
  935. this.setUp.saveButton = false
  936. }
  937. });
  938. return
  939. }else if(this.saveHeaderData.wareHouseName == ''){
  940. this.$alert("请输入库房名称!", '操作提示', {
  941. confirmButtonText: '确定',
  942. callback: action => {
  943. this.setUp.saveButton = false
  944. }
  945. });
  946. return
  947. }else if(this.saveHeaderData.wareHouseTypeDb == ''){
  948. this.$alert("请选择库位类型!", '操作提示', {
  949. confirmButtonText: '确定',
  950. callback: action => {
  951. this.setUp.saveButton = false
  952. }
  953. });
  954. return
  955. }
  956. for (let i = 0; i < this.selectList.select2.length; i++) {
  957. if(this.selectList.select2[i].value == this.saveHeaderData.wareHouseTypeDb){
  958. this.saveHeaderData.wareHouseType = this.selectList.select2[i].label
  959. }
  960. }
  961. saveWarehouse(this.saveHeaderData).then(({data}) =>{
  962. this.setUp.saveButton = false
  963. if(data.code == 0){
  964. this.$message.success(data.msg)
  965. this.getDataList()
  966. this.setUp.reviewFlag = false
  967. }else {
  968. this.$alert(data.msg, '操作提示', {
  969. confirmButtonText: '确定',
  970. callback: action => {
  971. }
  972. });
  973. }
  974. })
  975. },
  976. initModel(row){
  977. this.setUp.reviewFlag = true
  978. this.setUp.saveButton = false
  979. this.setUp.readonlyFlag = false
  980. this.saveHeaderData.id = 0
  981. this.saveHeaderData.site = this.site
  982. this.saveHeaderData.wareHouseId = ''
  983. this.saveHeaderData.wareHouseName = ''
  984. this.saveHeaderData.wareHouseType = ''
  985. this.saveHeaderData.wareHouseTypeDb = ''
  986. this.saveHeaderData.active = 'Y'
  987. this.saveHeaderData.useLocation = 'Y'
  988. this.saveHeaderData.validStock = 'Y'
  989. this.saveHeaderData.keeper = ''
  990. this.saveHeaderData.companyId = ''
  991. if(row != null){
  992. this.setUp.readonlyFlag = true
  993. this.saveHeaderData.id = 1
  994. this.saveHeaderData.wareHouseId = row.wareHouseId
  995. this.saveHeaderData.wareHouseName = row.wareHouseName
  996. this.saveHeaderData.wareHouseType = row.wareHouseType
  997. this.saveHeaderData.wareHouseTypeDb = row.wareHouseTypeDb
  998. this.saveHeaderData.active = row.active
  999. }
  1000. },
  1001. // 打印方式
  1002. printReport(){
  1003. alert( this.$store.state.user.site)
  1004. //
  1005. // const LODOP = getLodop()
  1006. // if (LODOP) {
  1007. // var strBodyStyle = '<style>'
  1008. // strBodyStyle += 'table { border-top: 1 solid #000000; border-left: 1 solid #000000; border-collapse:collapse; border-spacing:0;}'
  1009. // strBodyStyle += 'caption { line-height:2em; }'
  1010. // strBodyStyle += 'td { border-right: 1 solid #000000; border-bottom: 1 solid #000000; text-align:center; padding:2px 3px; font-size:11px;}'
  1011. // strBodyStyle += '</style>' //设置打印样式
  1012. // var strFormHtml = strBodyStyle + '<body>' + document.getElementById('commmon').innerHTML + '</body>' //获取打印内容
  1013. //
  1014. // LODOP.PRINT_INIT('') //初始化
  1015. // LODOP.PRINT_DESIGN();
  1016. // //LODOP.PREVIEW();
  1017. // //LODOP.PRINT();
  1018. //
  1019. // LODOP.SET_PRINT_PAGESIZE(2, 0, 0, 'A4') //设置横向
  1020. // LODOP.ADD_PRINT_HTM('1%', '1%', '98%', '98%', strFormHtml) //设置打印内容
  1021. // LODOP.SET_PREVIEW_WINDOW(2, 0, 0, 800, 600, '') //设置预览窗口模式和大小
  1022. // LODOP.PREVIEW()
  1023. // }
  1024. },
  1025. // 校验用户是否收藏
  1026. favoriteIsOk(){
  1027. let userFavorite ={
  1028. userId:this.$store.state.user.id,
  1029. languageCode:this.$i18n.locale
  1030. }
  1031. userFavoriteList(userFavorite).then(({data}) =>{
  1032. let size = data.list.filter(item => item.userId==userFavorite.menuId).length;
  1033. if (size>0){
  1034. this.favorite = true
  1035. }else {
  1036. this.favorite = false
  1037. }
  1038. })
  1039. },
  1040. // 收藏 OR 取消收藏
  1041. favoriteFunction(){
  1042. let userFavorite ={
  1043. userId: this.$store.state.user.id,
  1044. functionId: this.$route.meta.menuId,
  1045. }
  1046. if (this.favorite){
  1047. // 取消收藏
  1048. this.$confirm(`确定取消收藏`, '提示', {
  1049. confirmButtonText: '确定',
  1050. cancelButtonText: '取消',
  1051. type: 'warning'
  1052. }).then(() => {
  1053. removeUserFavorite(userFavorite).then(({data})=>{
  1054. this.$message.success(data.msg)
  1055. this.favorite = false
  1056. })
  1057. })
  1058. }else {
  1059. // 收藏
  1060. saveUserFavorite(userFavorite).then(({data})=>{
  1061. this.$message.success(data.msg)
  1062. this.favorite = true
  1063. })
  1064. }
  1065. },
  1066. // 保存语言编辑
  1067. saveLanguageList(val) {
  1068. saveSysLanguageOne(val).then(({data}) => {
  1069. if (data.code == 0) {
  1070. this.$message.success(data.msg)
  1071. } else {
  1072. this.$message.error(data.msg)
  1073. }
  1074. })
  1075. },
  1076. // 编辑语言
  1077. addLanguageFun() {
  1078. if (this.querySysLanguagePack.languageCode) {
  1079. this.addLanguage = true
  1080. this.languageColumnList = []
  1081. let query = {
  1082. functionId: this.$route.meta.menuId,
  1083. tableId: "common1002",
  1084. languageCode: this.$i18n.locale
  1085. }
  1086. getTableDefaultListLanguage(query).then(({data}) => {
  1087. if (data.rows.length > 0) {
  1088. this.languageColumnList = data.rows
  1089. }
  1090. })
  1091. this.languageColumnList = this.columnList
  1092. searchLanguageListByLanguageCode(this.querySysLanguagePack).then(({data}) => {
  1093. this.languageDataList = data.rows
  1094. })
  1095. } else {
  1096. this.$message("请选中一种语言")
  1097. }
  1098. },
  1099. // 获取多语言列表
  1100. getLanguageList() {
  1101. searchSysLanguage(this.queryLanguage).then(({data}) => {
  1102. this.languageList = data.rows
  1103. })
  1104. },
  1105. // 获取button的词典
  1106. getFunctionButtonList() {
  1107. searchFunctionButtonList(this.queryButton).then(({data}) => {
  1108. if (data.code == 0 ) {
  1109. this.buttons = data.data
  1110. } else {
  1111. // saveButtonList(this.buttonList).then(({data}) => {
  1112. // })
  1113. }
  1114. })
  1115. },
  1116. // 获取语言词典
  1117. getSysLanguageParamList() {
  1118. searchSysLanguageParam(this.querySysLanguageParam).then(({data}) => {
  1119. this.sysLanguageParams = data.rows
  1120. })
  1121. },
  1122. // 打开页面设置
  1123. userSetting() {
  1124. this.visible = true;
  1125. let queryTable = {
  1126. userId: this.$store.state.user.name,
  1127. functionId: this.$route.meta.menuId,
  1128. tableId: this.$route.meta.menuId + 'WAHO01',
  1129. languageCode: this.$i18n.locale
  1130. }
  1131. this.$nextTick(() => {
  1132. this.$refs.column.init(queryTable);
  1133. });
  1134. },
  1135. // 获取 用户保存的 格式列
  1136. getTableUserColumn() {
  1137. getTableUserListLanguage(this.queryTableUser).then(({data}) => {
  1138. if (data.rows.length > 0) {
  1139. //this.columnList = []
  1140. this.columnList = data.rows
  1141. } else {
  1142. this.getColumnList()
  1143. }
  1144. })
  1145. },
  1146. // 保存 默认配置 列
  1147. async saveColumnList() {
  1148. // 删除所有的该页面下保存的数据
  1149. if (this.userColumnList) {
  1150. //删除 user自定义的数据
  1151. await removerUser(this.queryTable)
  1152. }
  1153. // 删除默认配置
  1154. await removerDefault(this.queryTable)
  1155. // 保存页面 table属性
  1156. let sumColumnList = this.columnList.concat(this.columnList1);
  1157. sumColumnList = sumColumnList.map(item=> {
  1158. return item = {
  1159. tableId: item.tableId,
  1160. tableName: item.tableName,
  1161. columnProp: item.columnProp,
  1162. columnLabel: item.columnLabel,
  1163. columnHidden: false,
  1164. columnImage: false,
  1165. columnSortable: false,
  1166. columnWidth: null,
  1167. format: null,
  1168. functionId: this.$route.meta.menuId,
  1169. sortLv: 0,
  1170. status: true,
  1171. fixed: '',
  1172. serialNumber: null,
  1173. columnType: null,
  1174. align: null
  1175. }
  1176. })
  1177. await saveTableDefaultList(sumColumnList)
  1178. // 保存页面 button label title 属性
  1179. let buttons = this.buttonList.map( item => {
  1180. return item = {
  1181. functionId: this.$route.meta.menuId,
  1182. languageValue: item.languageValue,
  1183. objectId: item.objectId,
  1184. objectType: item.objectType,
  1185. tableId: item.tableId
  1186. }
  1187. })
  1188. await saveButtonList(buttons)
  1189. this.getFunctionButtonList()
  1190. this.getColumnList()
  1191. },
  1192. // 获取 tableDefault 列
  1193. getColumnList() {
  1194. getTableDefaultListLanguage(this.queryTable).then(({data}) => {
  1195. if (!data.rows.length == 0) {
  1196. // this.showDefault = false
  1197. this.columnList = data.rows
  1198. } else {
  1199. // this.showDefault = true
  1200. }
  1201. })
  1202. },
  1203. // 获取数据列表
  1204. getDataList() {
  1205. this.dataListLoading = true
  1206. getWarehouseList(this.queryHeaderData).then(({data}) => {
  1207. if (data && data.code === 0) {
  1208. this.dataList = data.rows
  1209. // this.totalPage = data.page.totalCount
  1210. } else {
  1211. this.dataList = []
  1212. // this.totalPage = 0
  1213. }
  1214. this.dataListLoading = false
  1215. })
  1216. },
  1217. // 每页数
  1218. sizeChangeHandle(val) {
  1219. this.pageSize = val
  1220. this.pageIndex = 1
  1221. this.getDataList()
  1222. },
  1223. // 当前页
  1224. currentChangeHandle(val) {
  1225. this.pageIndex = val
  1226. this.getDataList()
  1227. },
  1228. // 多选
  1229. selectionChangeHandle(val) {
  1230. this.dataListSelections = val
  1231. },
  1232. // 删除
  1233. deleteHandle(id) {
  1234. var ids = id ? [id] : this.dataListSelections.map(item => {
  1235. return item.id
  1236. })
  1237. this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  1238. confirmButtonText: '确定',
  1239. cancelButtonText: '取消',
  1240. type: 'warning'
  1241. }).then(() => {
  1242. this.$http({
  1243. url: this.$http.adornUrl('//prd/delete'),
  1244. method: 'post',
  1245. data: this.$http.adornData(ids, false)
  1246. }).then(({data}) => {
  1247. if (data && data.code === 0) {
  1248. this.$message.success('操作成功')
  1249. this.getDataList()
  1250. } else {
  1251. this.$message.error(data.msg)
  1252. }
  1253. })
  1254. })
  1255. },
  1256. // 导出
  1257. fields(){
  1258. let json = "{"
  1259. this.columnList.forEach((item,index) =>{
  1260. if (index == this.columnList.length-1 ){
  1261. json +="\""+item.columnLabel+"\"" +":"+"\""+item.columnProp+"\""
  1262. }else {
  1263. json += "\""+item.columnLabel+"\"" +":"+"\""+item.columnProp+"\""+ ","
  1264. }
  1265. })
  1266. json +="}"
  1267. let s = eval("(" + json + ")")
  1268. return s
  1269. },
  1270. createExportData() {
  1271. // 点击导出按钮之后,开始导出数据之前的执行函数,返回值为需要下载的数据
  1272. // TODO:构造需要下载的数据返回
  1273. if(this.dataListSelections.length>0){
  1274. return this.dataListSelections;
  1275. }
  1276. return this.dataList;
  1277. },
  1278. startDownload() {
  1279. this._exportLoading = this.$loading({
  1280. lock: true,
  1281. text: '正在导出数据,请稍候...',
  1282. spinner: 'el-icon-loading',
  1283. background: 'rgba(0, 0, 0, 0.7)'
  1284. })
  1285. },
  1286. finishDownload() {
  1287. if (this._exportLoading) {
  1288. this._exportLoading.close()
  1289. this._exportLoading = null
  1290. }
  1291. },
  1292. // ==================== 仓储策略配置 ====================
  1293. // 打开仓储策略配置对话框
  1294. async openStorageConfigDialog(row) {
  1295. this.currentWarehouse = row;
  1296. this.configQuery = {
  1297. configCode: '',
  1298. configName: ''
  1299. };
  1300. this.storageConfigDialogVisible = true;
  1301. // 加载可选策略列表和已配置策略列表
  1302. await this.loadStorageConfigLists();
  1303. },
  1304. // 加载仓储策略列表
  1305. async loadStorageConfigLists() {
  1306. try {
  1307. // 加载可选策略(从StorageZoneConfig表)
  1308. const {data: availableData} = await getStorageZoneConfigList({
  1309. site: this.currentWarehouse.site
  1310. });
  1311. // 加载已配置策略(从WareHouseStorageZoneConfig表)
  1312. const {data: selectedData} = await getWarehouseStorageConfigList({
  1313. site: this.currentWarehouse.site,
  1314. warehouseId: this.currentWarehouse.wareHouseId
  1315. });
  1316. if (selectedData && selectedData.code === 0) {
  1317. this.selectedConfigList = selectedData.list || [];
  1318. }
  1319. // 过滤掉已配置的策略
  1320. if (availableData && availableData.code === 0) {
  1321. const selectedCodes = this.selectedConfigList.map(item => item.configCode);
  1322. this.availableConfigListAll = (availableData.list || []).filter(item =>
  1323. !selectedCodes.includes(item.configCode)
  1324. );
  1325. this.availableConfigList = this.availableConfigListAll;
  1326. }
  1327. } catch (error) {
  1328. this.$message.error('加载仓储策略列表失败');
  1329. console.error(error);
  1330. }
  1331. },
  1332. // 查询可选策略
  1333. searchAvailableConfigs() {
  1334. const configCode = this.configQuery.configCode.trim().toLowerCase();
  1335. const configName = this.configQuery.configName.trim().toLowerCase();
  1336. if (!configCode && !configName) {
  1337. this.availableConfigList = this.availableConfigListAll;
  1338. return;
  1339. }
  1340. this.availableConfigList = this.availableConfigListAll.filter(item => {
  1341. const matchCode = !configCode || (item.configCode && item.configCode.toLowerCase().includes(configCode));
  1342. const matchName = !configName || (item.configName && item.configName.toLowerCase().includes(configName));
  1343. return matchCode && matchName;
  1344. });
  1345. },
  1346. // 重置策略查询
  1347. resetConfigQuery() {
  1348. this.configQuery = {
  1349. configCode: '',
  1350. configName: ''
  1351. };
  1352. this.availableConfigList = this.availableConfigListAll;
  1353. },
  1354. // 可选策略表格行点击
  1355. availableConfigClickRow(row) {
  1356. this.$refs.availableConfigTable.toggleRowSelection(row);
  1357. },
  1358. // 可选策略选择变化
  1359. availableConfigSelectionChange(val) {
  1360. this.availableConfigSelections = val;
  1361. },
  1362. // 已配置策略表格行点击
  1363. selectedConfigClickRow(row) {
  1364. this.$refs.selectedConfigTable.toggleRowSelection(row);
  1365. },
  1366. // 已配置策略选择变化
  1367. selectedConfigSelectionChange(val) {
  1368. this.selectedConfigSelections = val;
  1369. },
  1370. // 添加仓储策略
  1371. async addStorageConfig() {
  1372. if (!this.availableConfigSelections || this.availableConfigSelections.length === 0) {
  1373. this.$message.warning('请选择要添加的策略');
  1374. return;
  1375. }
  1376. try {
  1377. const configList = this.availableConfigSelections.map(item => ({
  1378. site: this.currentWarehouse.site,
  1379. buNo: this.currentWarehouse.buNo,
  1380. warehouseId: this.currentWarehouse.wareHouseId,
  1381. configCode: item.configCode,
  1382. active: 'Y',
  1383. remark: item.configName + (item.description ? ' - ' + item.description : '')
  1384. }));
  1385. const {data} = await saveWarehouseStorageConfig(configList);
  1386. if (data && data.code === 0) {
  1387. this.$message.success('添加成功');
  1388. // 清空选择
  1389. this.availableConfigSelections = [];
  1390. // 重新加载列表(会自动过滤)
  1391. await this.loadStorageConfigLists();
  1392. // 如果有查询条件,重新应用查询
  1393. if (this.configQuery.configCode || this.configQuery.configName) {
  1394. this.searchAvailableConfigs();
  1395. }
  1396. } else {
  1397. this.$message.error(data.msg || '添加失败');
  1398. }
  1399. } catch (error) {
  1400. this.$message.error('添加失败');
  1401. console.error(error);
  1402. }
  1403. },
  1404. // 移除仓储策略
  1405. async removeStorageConfig() {
  1406. if (!this.selectedConfigSelections || this.selectedConfigSelections.length === 0) {
  1407. this.$message.warning('请选择要移除的策略');
  1408. return;
  1409. }
  1410. this.$confirm('确定要移除选中的策略吗?', '提示', {
  1411. confirmButtonText: '确定',
  1412. cancelButtonText: '取消',
  1413. type: 'warning'
  1414. }).then(async () => {
  1415. try {
  1416. const configCodes = this.selectedConfigSelections.map(item => item.configCode);
  1417. const {data} = await deleteWarehouseStorageConfig({
  1418. site: this.currentWarehouse.site,
  1419. warehouseId: this.currentWarehouse.wareHouseId,
  1420. configCodes: configCodes
  1421. });
  1422. if (data && data.code === 0) {
  1423. this.$message.success('移除成功');
  1424. // 清空选择
  1425. this.selectedConfigSelections = [];
  1426. // 重新加载列表(会自动过滤)
  1427. await this.loadStorageConfigLists();
  1428. // 如果有查询条件,重新应用查询
  1429. if (this.configQuery.configCode || this.configQuery.configName) {
  1430. this.searchAvailableConfigs();
  1431. }
  1432. } else {
  1433. this.$message.error(data.msg || '移除失败');
  1434. }
  1435. } catch (error) {
  1436. this.$message.error('移除失败');
  1437. console.error(error);
  1438. }
  1439. }).catch(() => {});
  1440. },
  1441. // ==================== 权限授权 ====================
  1442. // 打开权限授权对话框
  1443. async openAccessAuthDialog(row) {
  1444. this.currentWarehouse = row;
  1445. this.userQuery = {
  1446. username: '',
  1447. userDisplay: ''
  1448. };
  1449. this.accessAuthDialogVisible = true;
  1450. // 加载用户列表
  1451. await this.loadAccessAuthLists();
  1452. },
  1453. // 加载权限授权列表
  1454. async loadAccessAuthLists() {
  1455. try {
  1456. // 并行加载可选用户和已授权用户
  1457. const [{ data: availableData }, { data: selectedData }] = await Promise.all([
  1458. getUserList({ site: this.currentWarehouse.site }),
  1459. getAccessWarehouseList({
  1460. site: this.currentWarehouse.site,
  1461. warehouseId: this.currentWarehouse.wareHouseId
  1462. })
  1463. ]);
  1464. if (selectedData && selectedData.code === 0) {
  1465. this.selectedUserList = selectedData.list || [];
  1466. }
  1467. // 过滤掉已授权的用户
  1468. if (availableData && availableData.code === 0) {
  1469. const selectedUserIds = this.selectedUserList.map(item => item.userid);
  1470. this.availableUserListAll = (availableData.list || []).filter(item =>
  1471. !selectedUserIds.includes(item.username)
  1472. );
  1473. this.availableUserList = this.availableUserListAll;
  1474. }
  1475. } catch (error) {
  1476. this.$message.error('加载用户列表失败');
  1477. console.error(error);
  1478. }
  1479. },
  1480. // 查询可选用户
  1481. searchAvailableUsers() {
  1482. const username = this.userQuery.username.trim().toLowerCase();
  1483. const userDisplay = this.userQuery.userDisplay.trim().toLowerCase();
  1484. if (!username && !userDisplay) {
  1485. this.availableUserList = this.availableUserListAll;
  1486. return;
  1487. }
  1488. this.availableUserList = this.availableUserListAll.filter(item => {
  1489. const matchUsername = !username || (item.username && item.username.toLowerCase().includes(username));
  1490. const matchDisplay = !userDisplay || (item.userDisplay && item.userDisplay.toLowerCase().includes(userDisplay));
  1491. return matchUsername && matchDisplay;
  1492. });
  1493. },
  1494. // 重置用户查询
  1495. resetUserQuery() {
  1496. this.userQuery = {
  1497. username: '',
  1498. userDisplay: ''
  1499. };
  1500. this.availableUserList = this.availableUserListAll;
  1501. },
  1502. // 可选用户表格行点击
  1503. availableUserClickRow(row) {
  1504. this.$refs.availableUserTable.toggleRowSelection(row);
  1505. },
  1506. // 可选用户选择变化
  1507. availableUserSelectionChange(val) {
  1508. this.availableUserSelections = val;
  1509. },
  1510. // 已授权用户表格行点击
  1511. selectedUserClickRow(row) {
  1512. this.$refs.selectedUserTable.toggleRowSelection(row);
  1513. },
  1514. // 已授权用户选择变化
  1515. selectedUserSelectionChange(val) {
  1516. this.selectedUserSelections = val;
  1517. },
  1518. // 添加权限授权
  1519. async addAccessAuth() {
  1520. if (!this.availableUserSelections || this.availableUserSelections.length === 0) {
  1521. this.$message.warning('请选择要授权的用户');
  1522. return;
  1523. }
  1524. try {
  1525. const userList = this.availableUserSelections.map(item => ({
  1526. site: this.currentWarehouse.site,
  1527. buNo: this.currentWarehouse.buNo,
  1528. warehouseId: this.currentWarehouse.wareHouseId,
  1529. userid: item.username,
  1530. userName: item.userDisplay
  1531. }));
  1532. const {data} = await saveAccessWarehouse(userList);
  1533. if (data && data.code === 0) {
  1534. this.$message.success('授权成功');
  1535. // 清空选择
  1536. this.availableUserSelections = [];
  1537. // 重新加载列表(会自动过滤)
  1538. await this.loadAccessAuthLists();
  1539. // 如果有查询条件,重新应用查询
  1540. if (this.userQuery.username || this.userQuery.userDisplay) {
  1541. this.searchAvailableUsers();
  1542. }
  1543. } else {
  1544. this.$message.error(data.msg || '授权失败');
  1545. }
  1546. } catch (error) {
  1547. this.$message.error('授权失败');
  1548. console.error(error);
  1549. }
  1550. },
  1551. // 移除权限授权
  1552. async removeAccessAuth() {
  1553. if (!this.selectedUserSelections || this.selectedUserSelections.length === 0) {
  1554. this.$message.warning('请选择要移除的用户');
  1555. return;
  1556. }
  1557. this.$confirm('确定要移除选中用户的授权吗?', '提示', {
  1558. confirmButtonText: '确定',
  1559. cancelButtonText: '取消',
  1560. type: 'warning'
  1561. }).then(async () => {
  1562. try {
  1563. const userIds = this.selectedUserSelections.map(item => item.userid);
  1564. const {data} = await deleteAccessWarehouse({
  1565. site: this.currentWarehouse.site,
  1566. warehouseId: this.currentWarehouse.wareHouseId,
  1567. userIds: userIds
  1568. });
  1569. if (data && data.code === 0) {
  1570. this.$message.success('移除成功');
  1571. // 清空选择
  1572. this.selectedUserSelections = [];
  1573. // 重新加载列表(会自动过滤)
  1574. await this.loadAccessAuthLists();
  1575. // 如果有查询条件,重新应用查询
  1576. if (this.userQuery.username || this.userQuery.userDisplay) {
  1577. this.searchAvailableUsers();
  1578. }
  1579. } else {
  1580. this.$message.error(data.msg || '移除失败');
  1581. }
  1582. } catch (error) {
  1583. this.$message.error('移除失败');
  1584. console.error(error);
  1585. }
  1586. }).catch(() => {});
  1587. }
  1588. },
  1589. created() {
  1590. // this.getTableUserColumn()
  1591. // this.getSysLanguageParamList()
  1592. // this.getFunctionButtonList()
  1593. // this.favoriteIsOk()
  1594. }
  1595. }
  1596. </script>
  1597. <style scoped lang="scss">
  1598. .wrapper {
  1599. height: calc(100% - 40px);
  1600. }
  1601. .sl-input {
  1602. background-color: transparent;
  1603. border: 0 !important;
  1604. font-size: 12px !important;
  1605. height: 12px !important;
  1606. line-height: 14px !important;
  1607. background-color: transparent !important;
  1608. width: 140px;
  1609. }
  1610. .sl-input:focus, textarea:focus {
  1611. outline: none;
  1612. }
  1613. .sl-svg{
  1614. overflow: hidden;
  1615. float: right;
  1616. }
  1617. /* ==================== 配置对话框样式 ==================== */
  1618. /deep/ .config-dialog {
  1619. border-radius: 8px;
  1620. box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  1621. }
  1622. /deep/ .config-dialog .el-dialog__header {
  1623. background: linear-gradient(135deg, #9ac3d0 20%, #b6c7dd 80%);
  1624. padding: 20px 24px;
  1625. border-radius: 8px 8px 0 0;
  1626. }
  1627. /deep/ .config-dialog .el-dialog__title {
  1628. color: #ffffff;
  1629. font-size: 18px;
  1630. font-weight: 600;
  1631. }
  1632. /deep/ .config-dialog .el-dialog__headerbtn .el-dialog__close {
  1633. color: #ffffff;
  1634. font-size: 20px;
  1635. font-weight: bold;
  1636. }
  1637. /deep/ .config-dialog .el-dialog__headerbtn .el-dialog__close:hover {
  1638. color: #f0f0f0;
  1639. }
  1640. /deep/ .config-dialog .el-dialog__body {
  1641. padding: 0;
  1642. background: #f5f7fa;
  1643. }
  1644. /* 查询区域 */
  1645. .search-section {
  1646. padding: 16px 24px;
  1647. background: #ffffff;
  1648. border-bottom: 1px solid #e8e8e8;
  1649. .el-form {
  1650. margin-bottom: 0;
  1651. }
  1652. .el-form-item {
  1653. margin-bottom: 0;
  1654. }
  1655. }
  1656. /* 项目操作容器 */
  1657. .item-operation-content {
  1658. display: flex;
  1659. gap: 16px;
  1660. align-items: stretch;
  1661. padding: 0px;
  1662. }
  1663. /* 面板样式 */
  1664. .item-panel {
  1665. flex: 1;
  1666. background: #ffffff;
  1667. border-radius: 6px;
  1668. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  1669. overflow: hidden;
  1670. transition: all 0.3s ease;
  1671. }
  1672. .item-panel:hover {
  1673. box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  1674. }
  1675. .available-panel {
  1676. flex: 1.5;
  1677. }
  1678. .selected-panel {
  1679. flex: 1;
  1680. }
  1681. .auth-panel {
  1682. flex: 1;
  1683. }
  1684. /* 面板头部 */
  1685. .panel-header {
  1686. padding: 8px 16px;
  1687. background: linear-gradient(135deg, #9ac3d0 20%, #b6c7dd 80%);
  1688. border-bottom: 2px solid #9ac3d0;
  1689. display: flex;
  1690. align-items: center;
  1691. gap: 8px;
  1692. }
  1693. .panel-header i {
  1694. font-size: 18px;
  1695. color: #ffffff;
  1696. }
  1697. .panel-title {
  1698. font-size: 15px;
  1699. font-weight: 600;
  1700. color: #ffffff;
  1701. flex: 1;
  1702. }
  1703. .item-count {
  1704. font-size: 13px;
  1705. color: #ffffff;
  1706. background: rgba(255, 255, 255, 0.2);
  1707. padding: 2px 10px;
  1708. border-radius: 12px;
  1709. font-weight: 500;
  1710. }
  1711. /* 表格样式 */
  1712. .operation-table {
  1713. border: none;
  1714. }
  1715. /deep/ .operation-table .el-table__body-wrapper {
  1716. max-height: 420px;
  1717. overflow-y: auto;
  1718. }
  1719. /deep/ .operation-table .el-table__row {
  1720. cursor: pointer;
  1721. transition: background-color 0.2s ease;
  1722. }
  1723. /deep/ .operation-table .el-table__row:hover {
  1724. background-color: #f0f9ff !important;
  1725. }
  1726. /deep/ .operation-table .current-row > td {
  1727. background-color: #e6f7ff !important;
  1728. }
  1729. /* 操作按钮 */
  1730. .operation-buttons {
  1731. display: flex;
  1732. flex-direction: column;
  1733. justify-content: center;
  1734. align-items: center;
  1735. gap: 20px;
  1736. padding: 0 8px;
  1737. }
  1738. .operation-buttons .el-button {
  1739. width: 48px;
  1740. height: 48px;
  1741. font-size: 20px;
  1742. transition: all 0.3s ease;
  1743. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  1744. }
  1745. .operation-buttons .el-button:hover {
  1746. transform: scale(1.1);
  1747. box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  1748. }
  1749. .operation-buttons .el-button.is-disabled {
  1750. opacity: 0.4;
  1751. cursor: not-allowed;
  1752. }
  1753. .operation-buttons .el-button--primary {
  1754. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  1755. border: none;
  1756. }
  1757. .operation-buttons .el-button--danger {
  1758. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  1759. border: none;
  1760. }
  1761. /* 底部按钮 */
  1762. .dialog-footer {
  1763. text-align: center;
  1764. padding: 16px 0 0;
  1765. }
  1766. .dialog-footer .el-button {
  1767. min-width: 100px;
  1768. font-weight: 500;
  1769. }
  1770. /* 响应式优化 */
  1771. @media (max-width: 1300px) {
  1772. .item-operation-content {
  1773. gap: 12px;
  1774. }
  1775. .operation-buttons .el-button {
  1776. width: 42px;
  1777. height: 42px;
  1778. font-size: 18px;
  1779. }
  1780. }
  1781. </style>