冷凝胶前端
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.

997 lines
30 KiB

2 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
  4. <el-button @click="getData()" type="primary" style="margin-left: 2px;margin-top: 0px">{{ buttons.search }}
  5. </el-button>
  6. <el-button @click="addModal()" type="primary" :disabled="authAdd"
  7. style="margin-left: 2px;margin-top: 0px">{{ buttons.add }}
  8. </el-button>
  9. <download-excel
  10. :fields="fields()"
  11. :data="exportData"
  12. type="xls"
  13. :name="exportName"
  14. :header="exportHeader"
  15. :footer="exportFooter"
  16. :fetch="createExportData"
  17. :before-generate="startDownload"
  18. :before-finish="finishDownload"
  19. worksheet="导出信息"
  20. class="el-button el-button--primary el-button--medium">
  21. {{ buttons.download }}
  22. </download-excel>
  23. </el-form>
  24. <el-table
  25. :height="height"
  26. :data="dataList"
  27. border
  28. v-loading="dataListLoading"
  29. style="width: 100%;">
  30. <el-table-column
  31. header-align="center"
  32. align="center"
  33. width="180"
  34. fixed="right"
  35. label="操作">
  36. <template slot-scope="scope">
  37. <a type="text" size="small" v-if="scope.row.active=='Y'"
  38. @click="accessSiteModel(scope.row)">{{ buttons.role }}</a>
  39. <a type="text" size="small" v-if="!authEdit" @click="editSite(scope.row)">{{ buttons.update }}</a>
  40. <a type="text" size="small" @click="getCompanyInformation(scope.row)">{{ buttons.companyInformation }}</a>
  41. <!-- //v-if="jumpFlag"-->
  42. </template>
  43. </el-table-column>
  44. <el-table-column
  45. v-for="(item,index) in columnList" :key="index"
  46. :sortable="item.columnSortable"
  47. :prop="item.columnProp"
  48. :header-align="item.headerAlign"
  49. :show-overflow-tooltip="item.showOverflowTooltip"
  50. :align="item.align"
  51. :fixed="item.fixed==''?false:item.fixed"
  52. :width="item.columnWidth"
  53. :label="item.columnLabel">
  54. <template slot-scope="scope">
  55. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  56. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  57. style="width: 100px; height: 80px"/></span>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <el-dialog :title=labels.factoryInformation :close-on-click-modal="false" v-drag :visible.sync="siteFlag"
  62. width="630px">
  63. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  64. <el-form-item :label="labels.site">
  65. <el-input v-model="siteData.siteID" :disabled="siteInputFlag" style="width: 130px"></el-input>
  66. </el-form-item>
  67. <el-form-item :label=labels.siteName_cn>
  68. <el-input v-model="siteData.siteName" style="width: 130px"></el-input>
  69. </el-form-item>
  70. <el-form-item :label=labels.siteName_en>
  71. <el-input v-model="siteData.siteNameE" style="width: 130px"></el-input>
  72. </el-form-item>
  73. <el-form-item :label=labels.postCode>
  74. <el-input v-model="siteData.postCode" style="width: 130px"></el-input>
  75. </el-form-item>
  76. </el-form>
  77. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  78. <el-form-item>
  79. <span slot="label" style="" @click="getBaseList(1003)"><a herf="#">{{ labels.company }}</a></span>
  80. <el-input v-model="siteData.companyID" style="width: 130px"></el-input>
  81. </el-form-item>
  82. <el-form-item :label=labels.referenceCustomerID>
  83. <el-input v-model="siteData.referenceCustomerID" style="width: 130px"></el-input>
  84. </el-form-item>
  85. <el-form-item :label=labels.active>
  86. <el-select filterable v-model="siteData.active" style="width: 130px">
  87. <el-option label="是" value="Y"></el-option>
  88. <el-option label="否" value="N"></el-option>
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item :label=labels.shipTime>
  92. <el-time-picker
  93. format="HH:mm:ss"
  94. style="width: 130px"
  95. v-model="siteData.shipTime"
  96. placeholder="请选择"
  97. value-format="HH:mm:ss">
  98. </el-time-picker>
  99. </el-form-item>
  100. </el-form>
  101. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  102. <el-form-item :label=labels.contactName>
  103. <el-input v-model="siteData.contactName" style="width: 130px"></el-input>
  104. </el-form-item>
  105. <el-form-item :label=labels.phoneNo>
  106. <el-input v-model="siteData.phoneNo" style="width: 130px"></el-input>
  107. </el-form-item>
  108. <el-form-item :label=labels.email>
  109. <el-input v-model="siteData.email" style="width: 130px"></el-input>
  110. </el-form-item>
  111. <el-form-item :label=labels.faxNo>
  112. <el-input v-model="siteData.faxNo" style="width: 130px"></el-input>
  113. </el-form-item>
  114. </el-form>
  115. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  116. <el-form-item :label=labels.address>
  117. <el-input v-model="siteData.address" type="textarea" :autosize="{ minRows: 1, maxRows: 6}"
  118. style="width: 562px"></el-input>
  119. </el-form-item>
  120. </el-form>
  121. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
  122. <el-form-item :label=labels.addressE>
  123. <el-input v-model="siteData.addressE" type="textarea" :autosize="{ minRows: 1, maxRows: 6}"
  124. style="width: 562px"></el-input>
  125. </el-form-item>
  126. </el-form>
  127. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
  128. <el-form-item :label=labels.website>
  129. <el-input v-model="siteData.website" type="textarea" :autosize="{ minRows: 1, maxRows: 6}"
  130. style="width: 562px"></el-input>
  131. </el-form-item>
  132. </el-form>
  133. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  134. <el-button type="primary" @click="siteSave()">{{ buttons.save }}</el-button>
  135. <el-button type="primary" @click="siteFlag = false">{{ buttons.close }}</el-button>
  136. </el-footer>
  137. </el-dialog>
  138. <!-- 动态列 -->
  139. <column v-if="visible" ref="column" @refreshData="getTableUserColumn" v-drag></column>
  140. <!-- 授权 -->
  141. <el-dialog
  142. style="font-size: 12px"
  143. v-drag
  144. :title="'工厂授权'"
  145. :visible.sync="accessSiteVisible"
  146. width="518px"
  147. :append-to-body="true">
  148. <el-transfer class="rq" v-model="accessSiteList" filterable :props="{
  149. key: 'username',
  150. label: 'userDisplay'
  151. }" :data="userList" :titles="['未授权', '已授权']"></el-transfer>
  152. <span slot="footer" class="dialog-footer">
  153. <div style="margin-top: 5px">
  154. <el-button type="primary" @click="saveAccessSite()">确定</el-button>
  155. <el-button @click="accessSiteVisible = false" type="primary">取消</el-button>
  156. </div>
  157. </span>
  158. </el-dialog>
  159. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  160. </div>
  161. </template>
  162. <script>
  163. import column from "@/views/modules/common/column";
  164. import {
  165. getSiteData,
  166. getCompanyData,
  167. siteSave,
  168. searchAccessSiteListBySite,
  169. saveAccessSiteForSite
  170. } from "@/api/base/site.js"
  171. import {
  172. searchFunctionButtonList,
  173. } from "@/api/sysLanguage.js"
  174. import {
  175. getTableDefaultListLanguage,
  176. getTableUserListLanguage,
  177. } from "@/api/table.js"
  178. import Chooselist from '@/views/modules/common/Chooselist'
  179. import {siteList} from "../../../api/base/site";
  180. var functionId = '100001002';
  181. export default {
  182. name: "factoryInformation",
  183. components: {
  184. column, Chooselist
  185. },
  186. data() {
  187. return {
  188. rowSite: '',
  189. accessSiteVisible: false,
  190. accessSiteList: [],
  191. userList: [],
  192. queryTable: {
  193. functionId: this.$route.meta.menuId,
  194. tableId: "100001002Table",
  195. languageCode: this.$i18n.locale
  196. },
  197. // 用户table 查询参数
  198. queryTableUser: {
  199. userId: this.$store.state.user.name,
  200. functionId: this.$route.meta.menuId,
  201. tableId: "100001002Table",
  202. status: true,
  203. languageCode: this.$i18n.locale
  204. },
  205. jumpFlag: true,
  206. authEdit: false,
  207. authAdd: false,
  208. authDelete: false,
  209. menuId: this.$route.meta.menuId,
  210. tagNo: '',
  211. // 导出 start
  212. exportData: [],
  213. exportName: "工厂信息" + this.dayjs().format('YYYYMMDDHHmmss'),
  214. exportHeader: ["工厂信息"],
  215. exportFooter: [],
  216. // 导出 end
  217. dataListLoading: false,
  218. // 多语言 start
  219. // 用户table 配置集合
  220. buttonList: [
  221. {
  222. functionId: functionId,
  223. languageValue: '查询',
  224. objectId: 'search',
  225. objectType: 'button',
  226. tableId: '*',
  227. }, {
  228. functionId: functionId,
  229. languageValue: '新增',
  230. objectId: 'add',
  231. objectType: 'button',
  232. tableId: '*',
  233. }, {
  234. functionId: functionId,
  235. languageValue: '导出',
  236. objectId: 'download',
  237. objectType: 'button',
  238. tableId: '*',
  239. }, {
  240. functionId: functionId,
  241. languageValue: '修改',
  242. objectId: 'update',
  243. objectType: 'button',
  244. tableId: '*',
  245. }, {
  246. functionId: functionId,
  247. languageValue: '查看会计单位信息',
  248. objectId: 'companyInformation',
  249. objectType: 'button',
  250. tableId: '*',
  251. }, {
  252. functionId: functionId,
  253. languageValue: '保存',
  254. objectId: 'save',
  255. objectType: 'button',
  256. tableId: '*',
  257. }, {
  258. functionId: functionId,
  259. languageValue: '关闭',
  260. objectId: 'close',
  261. objectType: 'button',
  262. tableId: '*',
  263. },
  264. ],
  265. labelsList: [
  266. {
  267. functionId: functionId,
  268. languageValue: '工厂编码',
  269. objectId: 'site',
  270. objectType: 'label',
  271. tableId: '*',
  272. }, {
  273. functionId: functionId,
  274. languageValue: '工厂信息',
  275. objectId: 'factoryInformation',
  276. objectType: 'label',
  277. tableId: '*',
  278. }, {
  279. functionId: functionId,
  280. languageValue: '工厂名称(中文)',
  281. objectId: 'siteName_cn',
  282. objectType: 'label',
  283. tableId: '*',
  284. }, {
  285. functionId: functionId,
  286. languageValue: '工厂名称(英文)',
  287. objectId: 'siteName_en',
  288. objectType: 'label',
  289. tableId: '*',
  290. }, {
  291. functionId: functionId,
  292. languageValue: '邮政编码',
  293. objectId: 'postCode',
  294. objectType: 'label',
  295. tableId: '*',
  296. }, {
  297. functionId: functionId,
  298. languageValue: '会计单位',
  299. objectId: 'company',
  300. objectType: 'label',
  301. tableId: '*',
  302. }, {
  303. functionId: functionId,
  304. languageValue: '参照客户编码',
  305. objectId: 'referenceCustomerID',
  306. objectType: 'label',
  307. tableId: '*',
  308. }, {
  309. functionId: functionId,
  310. languageValue: '在用',
  311. objectId: 'active',
  312. objectType: 'label',
  313. tableId: '*',
  314. }, {
  315. functionId: functionId,
  316. languageValue: '发货时间',
  317. objectId: 'shipTime',
  318. objectType: 'label',
  319. tableId: '*',
  320. }, {
  321. functionId: functionId,
  322. languageValue: '联系人',
  323. objectId: 'contactName',
  324. objectType: 'label',
  325. tableId: '*',
  326. }, {
  327. functionId: functionId,
  328. languageValue: '电话',
  329. objectId: 'phoneNo',
  330. objectType: 'label',
  331. tableId: '*',
  332. }, {
  333. functionId: functionId,
  334. languageValue: 'email',
  335. objectId: 'email',
  336. objectType: 'label',
  337. tableId: '*',
  338. }, {
  339. functionId: functionId,
  340. languageValue: '传真',
  341. objectId: 'faxNo',
  342. objectType: 'label',
  343. tableId: '*',
  344. }, {
  345. functionId: functionId,
  346. languageValue: '地址(中文)',
  347. objectId: 'address',
  348. objectType: 'label',
  349. tableId: '*',
  350. }, {
  351. functionId: functionId,
  352. languageValue: '地址(英文)',
  353. objectId: 'addressE',
  354. objectType: 'label',
  355. tableId: '*',
  356. }, {
  357. functionId: functionId,
  358. languageValue: '公司网站',
  359. objectId: 'website',
  360. objectType: 'label',
  361. tableId: '*',
  362. },
  363. ],
  364. labels: {
  365. site: '工厂编码',
  366. factoryInformation: '工厂信息',
  367. siteName_cn: '工厂名称(中文)',
  368. siteName_en: '工厂名称(英文)',
  369. postCode: '邮政编码',
  370. company: '会计单位',
  371. referenceCustomerID: '参照客户编码',
  372. active: '在用',
  373. shipTime: '发货时间',
  374. contactName: '联系人',
  375. phoneNo: '电话',
  376. email: 'email',
  377. faxNo: '传真',
  378. address: '地址(中文)',
  379. addressE: '地址(英文)',
  380. website: '公司网站',
  381. },
  382. buttons: {
  383. search: '查询',
  384. add: '新增',
  385. download: '导出',
  386. update: '修改',
  387. companyInformation: '查看会计单位信息',
  388. save: '保存',
  389. close: '关闭',
  390. role: '授权',
  391. },
  392. queryButton: {
  393. functionId: functionId,
  394. table_id: '*',
  395. languageCode: this.$i18n.locale,
  396. objectType: 'button'
  397. },
  398. queryLabel: {
  399. functionId: functionId,
  400. table_id: '*',
  401. languageCode: this.$i18n.locale,
  402. objectType: 'label'
  403. },
  404. visible: false,
  405. // 多语言 end
  406. height: 200,
  407. siteFlag: false,
  408. siteInputFlag: true,
  409. siteData: {
  410. add: '',
  411. siteID: '',
  412. siteName: '',
  413. siteNameE: '',
  414. companyID: '',
  415. postCode: '',
  416. address: '',
  417. addressE: '',
  418. website: '',
  419. contactName: '',
  420. phoneNo: '',
  421. faxNo: '',
  422. email: '',
  423. active: 'Y',
  424. shipTime: '',
  425. referenceCustomerID: '',
  426. },
  427. dataList: [],
  428. columnList: [
  429. {
  430. userId: this.$store.state.user.name,
  431. functionId: 100001002,
  432. serialNumber: '100001002TableSiteID',
  433. tableId: "100001002Table",
  434. tableName: "工厂信息表",
  435. columnProp: "siteID",
  436. headerAlign: "center",
  437. align: "left",
  438. columnLabel: "工厂编码",
  439. columnHidden: false,
  440. columnImage: false,
  441. columnSortable: false,
  442. sortLv: 10,
  443. status: true,
  444. fixed: '',
  445. columnWidth: 60
  446. },
  447. {
  448. userId: this.$store.state.user.name,
  449. functionId: 100001002,
  450. serialNumber: '100001002TableSiteName',
  451. tableId: "100001002Table",
  452. tableName: "工厂信息表",
  453. columnProp: "siteName",
  454. headerAlign: "center",
  455. align: "left",
  456. columnLabel: "工厂名称",
  457. columnHidden: false,
  458. columnImage: false,
  459. columnSortable: false,
  460. sortLv: 20,
  461. status: true,
  462. fixed: '',
  463. columnWidth: 120
  464. },
  465. {
  466. userId: this.$store.state.user.name,
  467. functionId: 100001002,
  468. serialNumber: '100001002TableSiteNameE',
  469. tableId: "100001002Table",
  470. tableName: "工厂信息表",
  471. columnProp: "siteNameE",
  472. headerAlign: "center",
  473. align: "left",
  474. columnLabel: "工厂名称(英文)",
  475. columnHidden: false,
  476. columnImage: false,
  477. columnSortable: false,
  478. sortLv: 30,
  479. status: true,
  480. fixed: '',
  481. columnWidth: 200
  482. },
  483. {
  484. userId: this.$store.state.user.name,
  485. functionId: 100001002,
  486. serialNumber: '100001002TableCompanyID',
  487. tableId: "100001002Table",
  488. tableName: "工厂信息表",
  489. columnProp: "companyID",
  490. headerAlign: "center",
  491. align: "left",
  492. columnLabel: "会计单位",
  493. columnHidden: false,
  494. columnImage: false,
  495. columnSortable: false,
  496. sortLv: 40,
  497. status: true,
  498. fixed: '',
  499. columnWidth: 100
  500. },
  501. {
  502. userId: this.$store.state.user.name,
  503. functionId: 100001002,
  504. serialNumber: '100001002TableCompanyName',
  505. tableId: "100001002Table",
  506. tableName: "工厂信息表",
  507. columnProp: "companyName",
  508. headerAlign: "center",
  509. align: "left",
  510. columnLabel: "会计单位名称",
  511. columnHidden: false,
  512. columnImage: false,
  513. columnSortable: false,
  514. sortLv: 50,
  515. status: true,
  516. fixed: '',
  517. columnWidth: 150
  518. },
  519. {
  520. userId: this.$store.state.user.name,
  521. functionId: 100001002,
  522. serialNumber: '100001002TableAddress',
  523. tableId: "100001002Table",
  524. tableName: "工厂信息表",
  525. columnProp: "address",
  526. headerAlign: "center",
  527. align: "left",
  528. columnLabel: "地址",
  529. columnHidden: false,
  530. columnImage: false,
  531. columnSortable: false,
  532. sortLv: 60,
  533. status: true,
  534. fixed: '',
  535. columnWidth: 200
  536. },
  537. {
  538. userId: this.$store.state.user.name,
  539. functionId: 100001002,
  540. serialNumber: '100001002TableAddressE',
  541. tableId: "100001002Table",
  542. tableName: "工厂信息表",
  543. columnProp: "addressE",
  544. headerAlign: "center",
  545. align: "left",
  546. columnLabel: "地址(英文)",
  547. columnHidden: false,
  548. columnImage: false,
  549. columnSortable: false,
  550. sortLv: 70,
  551. status: true,
  552. fixed: '',
  553. columnWidth: 200
  554. },
  555. {
  556. userId: this.$store.state.user.name,
  557. functionId: 100001002,
  558. serialNumber: '100001002TableWebsite',
  559. tableId: "100001002Table",
  560. tableName: "工厂信息表",
  561. columnProp: "website",
  562. headerAlign: "center",
  563. align: "left",
  564. columnLabel: "公司网址",
  565. columnHidden: false,
  566. columnImage: false,
  567. columnSortable: false,
  568. sortLv: 80,
  569. status: true,
  570. fixed: '',
  571. columnWidth: 150
  572. },
  573. {
  574. userId: this.$store.state.user.name,
  575. functionId: 100001002,
  576. serialNumber: '100001002TableContactName',
  577. tableId: "100001002Table",
  578. tableName: "工厂信息表",
  579. columnProp: "contactName",
  580. headerAlign: "center",
  581. align: "left",
  582. columnLabel: "联系人",
  583. columnHidden: false,
  584. columnImage: false,
  585. columnSortable: false,
  586. sortLv: 90,
  587. status: true,
  588. fixed: '',
  589. columnWidth: 100
  590. },
  591. {
  592. userId: this.$store.state.user.name,
  593. functionId: 100001002,
  594. serialNumber: '100001002TablePostCode',
  595. tableId: "100001002Table",
  596. tableName: "工厂信息表",
  597. columnProp: "postCode",
  598. headerAlign: "center",
  599. align: "left",
  600. columnLabel: "邮政编码",
  601. columnHidden: false,
  602. columnImage: false,
  603. columnSortable: false,
  604. sortLv: 100,
  605. status: true,
  606. fixed: '',
  607. columnWidth: 100
  608. },
  609. {
  610. userId: this.$store.state.user.name,
  611. functionId: 100001002,
  612. serialNumber: '100001002TablePhoneNo',
  613. tableId: "100001002Table",
  614. tableName: "工厂信息表",
  615. columnProp: "phoneNo",
  616. headerAlign: "center",
  617. align: "left",
  618. columnLabel: "电话",
  619. columnHidden: false,
  620. columnImage: false,
  621. columnSortable: false,
  622. sortLv: 110,
  623. status: true,
  624. fixed: '',
  625. columnWidth: 100
  626. },
  627. {
  628. userId: this.$store.state.user.name,
  629. functionId: 100001002,
  630. serialNumber: '100001002TableFaxNo',
  631. tableId: "100001002Table",
  632. tableName: "工厂信息表",
  633. columnProp: "faxNo",
  634. headerAlign: "center",
  635. align: "left",
  636. columnLabel: "传真",
  637. columnHidden: false,
  638. columnImage: false,
  639. columnSortable: false,
  640. sortLv: 120,
  641. status: true,
  642. fixed: '',
  643. columnWidth: 100
  644. },
  645. {
  646. userId: this.$store.state.user.name,
  647. functionId: 100001002,
  648. serialNumber: '100001002TableEmail',
  649. tableId: "100001002Table",
  650. tableName: "工厂信息表",
  651. columnProp: "email ",
  652. headerAlign: "center",
  653. align: "left",
  654. columnLabel: "Email",
  655. columnHidden: false,
  656. columnImage: false,
  657. columnSortable: false,
  658. sortLv: 130,
  659. status: true,
  660. fixed: '',
  661. columnWidth: 100
  662. },
  663. {
  664. userId: this.$store.state.user.name,
  665. functionId: 100001002,
  666. serialNumber: '100001002TableActive',
  667. tableId: "100001002Table",
  668. tableName: "工厂信息表",
  669. columnProp: "active",
  670. headerAlign: "center",
  671. align: "left",
  672. columnLabel: "在用",
  673. columnHidden: false,
  674. columnImage: false,
  675. columnSortable: false,
  676. sortLv: 140,
  677. status: true,
  678. fixed: '',
  679. columnWidth: 50
  680. },
  681. {
  682. userId: this.$store.state.user.name,
  683. functionId: 100001002,
  684. serialNumber: '100001002TableShipTime',
  685. tableId: "100001002Table",
  686. tableName: "工厂信息表",
  687. columnProp: "shipTime",
  688. headerAlign: "center",
  689. align: "left",
  690. columnLabel: "发货时间",
  691. columnHidden: false,
  692. columnImage: false,
  693. columnSortable: false,
  694. sortLv: 150,
  695. status: true,
  696. fixed: '',
  697. columnWidth: 120
  698. }
  699. ],
  700. }
  701. },
  702. mounted() {
  703. this.$nextTick(() => {
  704. this.height = window.innerHeight - 140;
  705. })
  706. },
  707. watch: {
  708. '$route'(to, from) {
  709. if (localStorage.getItem('factoryInformation') != undefined) {
  710. this.getData();
  711. }
  712. }
  713. },
  714. methods: {
  715. getBaseData(val) {
  716. this.$nextTick(() => {
  717. if (this.tagNo === 1003) {
  718. this.siteData.companyID = val.CompanyID
  719. }
  720. })
  721. },
  722. // 获取基础数据列表
  723. getBaseList(val) {
  724. this.tagNo = val
  725. this.$nextTick(() => {
  726. let strVal = "";
  727. if (val === 1003 && this.siteData.companyID) {
  728. strVal = this.siteData.companyID
  729. }
  730. this.$refs.baseList.init(val, strVal)
  731. })
  732. },
  733. getData() {
  734. let data = {};
  735. if (localStorage.getItem('factoryInformation') != undefined) {
  736. data = JSON.parse(localStorage.getItem('factoryInformation'));
  737. }
  738. localStorage.removeItem('factoryInformation');
  739. getSiteData(data).then(({data}) => {
  740. this.dataList = data.rows
  741. })
  742. },
  743. addModal() {
  744. this.siteData = {
  745. add: '',
  746. siteID: '',
  747. siteName: '',
  748. siteNameE: '',
  749. companyID: '',
  750. postCode: '',
  751. address: '',
  752. addressE: '',
  753. website: '',
  754. contactName: '',
  755. phoneNo: '',
  756. faxNo: '',
  757. email: '',
  758. active: 'Y',
  759. shipTime: '',
  760. referenceCustomerID: '',
  761. },
  762. this.siteData.add = 0;
  763. this.siteInputFlag = false;
  764. this.siteData.active = 'Y';
  765. this.siteFlag = true;
  766. },
  767. editSite(row) {
  768. this.siteData = JSON.parse(JSON.stringify(row));
  769. this.siteData.add = 1;
  770. this.siteInputFlag = true;
  771. this.siteFlag = true;
  772. },
  773. siteSave() {
  774. siteSave(this.siteData).then(({data}) => {
  775. if (this.siteData.companyID == '' || this.siteData.companyID == null) {
  776. this.$alert("请选择会计单位!", '错误', {
  777. confirmButtonText: '确定'
  778. })
  779. return false;
  780. }
  781. if (this.siteData.siteID == '' || this.siteData.siteID == null) {
  782. this.$alert("请输入工厂编码!", '错误', {
  783. confirmButtonText: '确定'
  784. })
  785. return false;
  786. }
  787. if (this.siteData.siteName == '' || this.siteData.siteName == null) {
  788. this.$alert("请输入工厂名称!", '错误', {
  789. confirmButtonText: '确定'
  790. })
  791. return false;
  792. }
  793. if (data && data.code == 200) {
  794. this.siteFlag = false
  795. this.getData();
  796. this.$message.success('操作成功')
  797. } else {
  798. this.$alert(data.msg, '错误', {
  799. confirmButtonText: '确定'
  800. })
  801. }
  802. })
  803. },
  804. saveAccessSite() {
  805. let accessSiteList = []
  806. for (let i = 0; i < this.accessSiteList.length; i++) {
  807. let inData = {
  808. site: this.rowSite,
  809. userid: this.accessSiteList[i]
  810. }
  811. accessSiteList.push(inData)
  812. }
  813. let saveData = {
  814. site: this.rowSite,
  815. accessSiteList: accessSiteList,
  816. }
  817. saveAccessSiteForSite(saveData).then(({data}) => {
  818. if (data && data.code === 0) {
  819. this.$message.success('操作成功')
  820. this.accessSiteVisible = false
  821. } else {
  822. this.$message.error(data.msg)
  823. }
  824. })
  825. },
  826. //导出excel
  827. createExportData() {
  828. return this.dataList;
  829. },
  830. startDownload() {
  831. // this.exportData = this.dataList
  832. },
  833. finishDownload() {
  834. },
  835. fields() {
  836. let json = "{"
  837. this.columnList.forEach((item, index) => {
  838. if (index == this.columnList.length - 1) {
  839. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  840. } else {
  841. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  842. }
  843. })
  844. json += "}"
  845. let s = eval("(" + json + ")")
  846. return s
  847. },
  848. // 导出 end
  849. getCompanyInformation(row) {
  850. let inData = {companyID: row.companyID, companyName: row.companyName};
  851. localStorage.setItem('companyInformation', JSON.stringify(inData))
  852. this.$router.replace('base-companyInformation')
  853. },
  854. //获取按钮的权限数据
  855. getButtonAuthData() {
  856. let updateFlag = this.isAuth(this.menuId + ":revise");
  857. let fullControFlag = this.isAuth(this.menuId + ":fullContro");
  858. let deleteFlag = this.isAuth(this.menuId + ":remove");
  859. //处理页面的权限数据
  860. this.authEdit = !updateFlag || !fullControFlag;
  861. this.authAdd = !fullControFlag;
  862. this.authDelete = !deleteFlag;
  863. //跳转页面
  864. let menList = JSON.parse(sessionStorage.getItem('dynamicMenuRoutes') || '[]').filter(item => item.path == 'base-companyInformation')
  865. if (menList.length > 0) {
  866. this.jumpFlag = false
  867. }
  868. },
  869. accessSiteModel(row) {
  870. searchAccessSiteListBySite({
  871. site: row.siteID,
  872. }).then(({data}) => {
  873. this.accessSiteList = data.accessSiteList
  874. this.userList = data.userList
  875. })
  876. this.rowSite = row.siteID
  877. this.accessSiteVisible = true;
  878. },
  879. //多语言
  880. getMultiLanguageList() {
  881. //首先查询当前按钮的多语言
  882. searchFunctionButtonList(this.queryButton).then(({data}) => {
  883. if (data.code == 0) {
  884. this.buttons = data.data
  885. } else {
  886. // saveButtonList(this.buttonList).then(({data}) => {
  887. // })
  888. }
  889. });
  890. //其次查询当前标签的多语言
  891. searchFunctionButtonList(this.queryLabel).then(({data}) => {
  892. if (data.code == 0) {
  893. this.labels = data.data
  894. } else {
  895. // saveButtonList(this.buttonList).then(({data}) => {
  896. // })
  897. }
  898. });
  899. },
  900. // 打开页面设置
  901. userSetting() {
  902. this.visible = true;
  903. let queryTable = {
  904. userId: this.$store.state.user.name,
  905. functionId: this.$route.meta.menuId,
  906. tableId: this.queryTable.tableId,
  907. languageCode: this.$i18n.locale
  908. }
  909. this.$nextTick(() => {
  910. this.$refs.column.init(queryTable);
  911. });
  912. },
  913. // 获取 用户保存的 格式列
  914. getTableUserColumn(tableId) {
  915. console.log(tableId)
  916. getTableUserListLanguage(this.queryTableUser).then(({data}) => {
  917. if (data.rows.length > 0) {
  918. //this.columnList = []
  919. this.columnList = data.rows
  920. } else {
  921. this.getColumnList()
  922. }
  923. })
  924. },
  925. // 获取 tableDefault 列
  926. getColumnList() {
  927. getTableDefaultListLanguage(this.queryTable).then(({data}) => {
  928. if (!data.rows.length == 0) {
  929. // this.showDefault = false
  930. this.columnList = data.rows
  931. } else {
  932. // this.showDefault = true
  933. }
  934. })
  935. },
  936. getSiteDataDemo(params){
  937. params.no = 1
  938. params.size = 1
  939. // this.$message.success(params)
  940. siteList(params).then(({data})=>{
  941. if (data && data.code === 0){
  942. this.$message.success(data.msg)
  943. }else {
  944. this.$message.warning(data.msg)
  945. }
  946. }).catch((error)=>{
  947. this.$message.error(error)
  948. })
  949. }
  950. },
  951. created() {
  952. this.getMultiLanguageList()//刷新按钮
  953. this.getData();
  954. //获取按钮的权限
  955. this.getButtonAuthData();
  956. this.getTableUserColumn()
  957. },
  958. activated() {
  959. this.$store.commit("sift/commitSearchFunction",this.getSiteDataDemo)
  960. }
  961. }
  962. </script>
  963. <style>
  964. .el-textarea__inner {
  965. padding: 5px 5px;
  966. }
  967. </style>