plm前端
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.

1037 lines
31 KiB

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