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.

590 lines
18 KiB

  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
  4. <el-form-item :label="'BU:'">
  5. <el-select v-model="searchData.buNo" placeholder="请选择" >
  6. <el-option label="全部" value=""></el-option>
  7. <el-option
  8. v-for = "i in buList"
  9. :key = "i.buNo"
  10. :label = "i.buDesc"
  11. :value = "i.buNo">
  12. </el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item :label="'品名:'">
  16. <el-input v-model="searchData.hsCodeDesc" style="width: 120px"></el-input>
  17. </el-form-item>
  18. <el-form-item :label="'HS Code:'">
  19. <el-input v-model="searchData.hsCode" style="width: 120px"></el-input>
  20. </el-form-item>
  21. <el-form-item :label="' '" >
  22. <el-button @click="searchTable()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'查询'}}</el-button>
  23. <el-button @click="addModelOpen()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'新增'}}</el-button>
  24. </el-form-item>
  25. </el-form>
  26. <el-table
  27. @row-click="changeData"
  28. highlight-current-row
  29. :height="height"
  30. :data="dataList"
  31. ref="mainTable"
  32. border
  33. v-loading="dataListLoading"
  34. style="width: 100%;">
  35. <el-table-column
  36. header-align="center"
  37. align="center"
  38. width="100"
  39. fixed="left"
  40. label="操作">
  41. <template slot-scope="scope">
  42. <a type="text" size="small" @click="updateModelOpen(scope.row)">编辑</a>
  43. <a type="text" size="small" @click="deleteHsCode(scope.row)">删除</a>
  44. </template>
  45. </el-table-column>
  46. <el-table-column
  47. v-for="(item,index) in columnList1" :key="index"
  48. :sortable="item.columnSortable"
  49. :prop="item.columnProp"
  50. :header-align="item.headerAlign"
  51. :show-overflow-tooltip="item.showOverflowTooltip"
  52. :align="item.align"
  53. :fixed="item.fixed==''?false:item.fixed"
  54. :min-width="item.columnWidth"
  55. :label="item.columnLabel">
  56. <template slot-scope="scope">
  57. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  58. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  59. style="width: 100px; height: 80px"/></span>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. <el-pagination
  64. @size-change="sizeChangeHandle"
  65. @current-change="currentChangeHandle"
  66. :current-page="pageIndex"
  67. :page-sizes="[20, 50, 100, 1000]"
  68. :page-size="pageSize"
  69. :total="totalPage"
  70. layout="total, sizes, prev, pager, next, jumper">
  71. </el-pagination>
  72. <el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick" >
  73. <el-tab-pane label="基本信息" name="attribute">
  74. <order-attribute ref="dialogAttribute" :site="currentRow.site" :buNo="currentRow.buNo" :order-no="currentRow.hsCodeDesc" :code-no="currentRow.codeNo" :function-type="'ECSS'"></order-attribute>
  75. </el-tab-pane>
  76. </el-tabs>
  77. <el-dialog title="维护HSCode" :close-on-click-modal="false" v-drag :visible.sync="addModelFlag" width="500px">
  78. <el-form label-position="top" style="margin-left: 7px;margin-top: -5px;">
  79. <el-row :gutter="20">
  80. <el-col :span="12">
  81. <el-form-item :label="'BU:'">
  82. <el-select v-model="addModel.buNo" placeholder="请选择" :disabled="addModel.addFlag!==0" style="width: 100%">
  83. <el-option
  84. v-for = "i in buList"
  85. :key = "i.buNo"
  86. :label = "i.buDesc"
  87. :value = "i.buNo">
  88. </el-option>
  89. </el-select>
  90. </el-form-item>
  91. </el-col>
  92. <el-col :span="12">
  93. <el-form-item :label="'品名'" >
  94. <el-input v-model="addModel.hsCodeDesc" :disabled="addModel.addFlag!==0" ></el-input>
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="12">
  98. <el-form-item :label="'英文品名'" >
  99. <el-input v-model="addModel.hsCodeDescEn" ></el-input>
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="12">
  103. <el-form-item :label="'HS Code'" >
  104. <el-input v-model="addModel.hsCode" ></el-input>
  105. </el-form-item>
  106. </el-col>
  107. <el-col :span="12">
  108. <el-form-item >
  109. <span slot="label" @click="getBaseList(33)"><a herf="#">属性模板</a></span>
  110. <el-input v-model="addModel.codeNo" ></el-input>
  111. </el-form-item>
  112. </el-col>
  113. <el-col :span="12">
  114. <el-form-item :label="'单位'" >
  115. <el-input v-model="addModel.unit" ></el-input>
  116. </el-form-item>
  117. </el-col>
  118. <el-col :span="24">
  119. <el-form-item :label="'备注'" >
  120. <el-input v-model="addModel.remark" ></el-input>
  121. </el-form-item>
  122. </el-col>
  123. </el-row>
  124. </el-form>
  125. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  126. <el-button type="primary" @click="saveHSCode()">保存</el-button>
  127. <el-button type="primary" @click="addModelFlag=false">关闭</el-button>
  128. </el-footer>
  129. </el-dialog>
  130. <!--列表的组件-->
  131. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  132. </div>
  133. </template>
  134. <script>
  135. import Chooselist from '@/views/modules/common/Chooselist_eam'
  136. import orderAttribute from "./orderProperties"
  137. import {} from "@/api/sysLanguage.js"
  138. import {
  139. searchHsCodeData,
  140. saveHSCodeData,
  141. deleteHsCode,
  142. }from "@/api/ecss/ecss.js"
  143. import {getBuList}from '@/api/factory/site.js'
  144. export default {
  145. name: "null",
  146. components:{
  147. orderAttribute,
  148. Chooselist,
  149. },
  150. data() {
  151. return {
  152. pageIndex: 1,
  153. pageSize: 100,
  154. totalPage: 0,
  155. height: 200,
  156. buList:[],
  157. dataList:[],
  158. dataList2:[],
  159. dataListLoading: false,
  160. searchData: {
  161. page: 1,
  162. limit: 100,
  163. buNo:'',
  164. hsCode:'',
  165. hsCodeDesc:'',
  166. codeNo:'',
  167. username:this.$store.state.user.name,
  168. },
  169. buttons:{
  170. search:'查询',
  171. },
  172. addModelFlag:false,
  173. addModel:{
  174. addFlag:0,
  175. site:'',
  176. buNo:'',
  177. hsCode:'',
  178. hsCodeDesc:'',
  179. hsCodeDescEn:'',
  180. codeNo:'',
  181. unit:'',
  182. remark:'',
  183. },
  184. addDisabledFlag:true,
  185. activeName:'attribute',
  186. columnList1: [
  187. {
  188. userId: this.$store.state.user.name,
  189. functionId: 801003,
  190. serialNumber: '801003Table1BuDesc',
  191. tableId: "801003Table1",
  192. tableName: "HsCode基础信息",
  193. columnProp: "buDesc",
  194. headerAlign: "center",
  195. align: "left",
  196. columnLabel: "BU",
  197. columnHidden: false,
  198. columnImage: false,
  199. columnSortable: false,
  200. sortLv: 0,
  201. status: true,
  202. fixed: '',
  203. columnWidth: 80
  204. },
  205. {
  206. userId: this.$store.state.user.name,
  207. functionId: 801003,
  208. serialNumber: '801003Table1HsCode',
  209. tableId: "801003Table1",
  210. tableName: "HsCode基础信息",
  211. columnProp: "hsCode",
  212. headerAlign: "center",
  213. align: "left",
  214. columnLabel: "HS Code",
  215. columnHidden: false,
  216. columnImage: false,
  217. columnSortable: false,
  218. sortLv: 0,
  219. status: true,
  220. fixed: '',
  221. columnWidth: 120
  222. },
  223. {
  224. userId: this.$store.state.user.name,
  225. functionId: 801003,
  226. serialNumber: '801003Table1HsCode',
  227. tableId: "801003Table1",
  228. tableName: "HsCode基础信息",
  229. columnProp: "hsCodeDesc",
  230. headerAlign: "center",
  231. align: "left",
  232. columnLabel: "品名",
  233. columnHidden: false,
  234. columnImage: false,
  235. columnSortable: false,
  236. sortLv: 0,
  237. status: true,
  238. fixed: '',
  239. columnWidth: 150
  240. },
  241. {
  242. userId: this.$store.state.user.name,
  243. functionId: 801003,
  244. serialNumber: '801003Table1HsCode',
  245. tableId: "801003Table1",
  246. tableName: "HsCode基础信息",
  247. columnProp: "hsCodeDescEn",
  248. headerAlign: "center",
  249. align: "left",
  250. columnLabel: "英文品名",
  251. columnHidden: false,
  252. columnImage: false,
  253. columnSortable: false,
  254. sortLv: 0,
  255. status: true,
  256. fixed: '',
  257. columnWidth: 150
  258. },
  259. {
  260. userId: this.$store.state.user.name,
  261. functionId: 801003,
  262. serialNumber: '801003Table1CodeNo',
  263. tableId: "801003Table1",
  264. tableName: "HsCode基础信息",
  265. columnProp: "codeNo",
  266. headerAlign: "center",
  267. align: "center",
  268. columnLabel: "模板编码",
  269. columnHidden: false,
  270. columnImage: false,
  271. columnSortable: false,
  272. sortLv: 0,
  273. status: true,
  274. fixed: '',
  275. columnWidth: 100
  276. },
  277. {
  278. userId: this.$store.state.user.name,
  279. functionId: 801003,
  280. serialNumber: '801003Table1CodeNo',
  281. tableId: "801003Table1",
  282. tableName: "HsCode基础信息",
  283. columnProp: "unit",
  284. headerAlign: "center",
  285. align: "center",
  286. columnLabel: "单位",
  287. columnHidden: false,
  288. columnImage: false,
  289. columnSortable: false,
  290. sortLv: 0,
  291. status: true,
  292. fixed: '',
  293. columnWidth: 100
  294. },
  295. {
  296. userId: this.$store.state.user.name,
  297. functionId: 801003,
  298. serialNumber: '801003Table1CreateBy',
  299. tableId: "801003Table1",
  300. tableName: "HsCode基础信息",
  301. columnProp: "createBy",
  302. headerAlign: "center",
  303. align: "center",
  304. columnLabel: "创建人",
  305. columnHidden: false,
  306. columnImage: false,
  307. columnSortable: false,
  308. sortLv: 0,
  309. status: true,
  310. fixed: '',
  311. columnWidth: 100
  312. },
  313. {
  314. userId: this.$store.state.user.name,
  315. functionId: 801003,
  316. serialNumber: '801003Table1CreateDate',
  317. tableId: "801003Table1",
  318. tableName: "HsCode基础信息",
  319. columnProp: "createDate",
  320. headerAlign: "center",
  321. align: "center",
  322. columnLabel: "创建日期",
  323. columnHidden: false,
  324. columnImage: false,
  325. columnSortable: false,
  326. sortLv: 0,
  327. status: true,
  328. fixed: '',
  329. columnWidth: 120
  330. },
  331. {
  332. userId: this.$store.state.user.name,
  333. functionId: 801003,
  334. serialNumber: '801003Table1UpdateBy',
  335. tableId: "801003Table1",
  336. tableName: "HsCode基础信息",
  337. columnProp: "updateBy",
  338. headerAlign: "center",
  339. align: "left",
  340. columnLabel: "修改人",
  341. columnHidden: false,
  342. columnImage: false,
  343. columnSortable: false,
  344. sortLv: 0,
  345. status: true,
  346. fixed: '',
  347. columnWidth: 100
  348. },
  349. {
  350. userId: this.$store.state.user.name,
  351. functionId: 801003,
  352. serialNumber: '801003Table1UpdateDate',
  353. tableId: "801003Table1",
  354. tableName: "HsCode基础信息",
  355. columnProp: "updateDate",
  356. headerAlign: "center",
  357. align: "center",
  358. columnLabel: "修改日期",
  359. columnHidden: false,
  360. columnImage: false,
  361. columnSortable: false,
  362. sortLv: 0,
  363. status: true,
  364. fixed: '',
  365. columnWidth: 100
  366. },
  367. {
  368. userId: this.$store.state.user.name,
  369. functionId: 801003,
  370. serialNumber: '801003Table1Remark',
  371. tableId: "801003Table1",
  372. tableName: "HsCode基础信息",
  373. columnProp: "remark",
  374. headerAlign: "center",
  375. align: "left",
  376. columnLabel: "备注",
  377. columnHidden: false,
  378. columnImage: false,
  379. columnSortable: false,
  380. sortLv: 0,
  381. status: true,
  382. fixed: '',
  383. columnWidth: 300
  384. },
  385. ],
  386. currentRow:{},
  387. }
  388. },
  389. mounted() {
  390. this.$nextTick(() => {
  391. this.height = (window.innerHeight - 240)/2;
  392. })
  393. },
  394. methods: {
  395. // 获取基础数据列表S
  396. getBaseList(val, type) {
  397. this.tagNo = val
  398. this.$nextTick(() => {
  399. let strVal = ''
  400. if (val === 33) {
  401. strVal = this.addModel.codeNo
  402. }
  403. this.$refs.baseList.init(val, strVal)
  404. })
  405. },
  406. /* 列表方法的回调 */
  407. getBaseData(val) {
  408. if (this.tagNo === 33) {
  409. this.addModel.codeNo = val.Code_No
  410. }
  411. },
  412. // 每页数
  413. sizeChangeHandle (val) {
  414. this.pageSize = val
  415. this.pageIndex = 1
  416. this.searchTable()
  417. },
  418. // 当前页
  419. currentChangeHandle (val) {
  420. this.pageIndex = val
  421. this.searchTable()
  422. },
  423. searchTable(){
  424. this.searchData.limit = this.pageSize
  425. this.searchData.page = this.pageIndex
  426. searchHsCodeData(this.searchData).then(({data}) => {
  427. //区分请求成功和失败的状况
  428. if (data && data.code == 0) {
  429. this.dataList = data.page.list
  430. this.pageIndex = data.page.currPage
  431. this.pageSize = data.page.pageSize
  432. this.totalPage = data.page.totalCount
  433. if(this.dataList.length>0){
  434. this.$refs.mainTable.setCurrentRow(this.dataList[0]);
  435. this.changeData(this.dataList[0])
  436. }else {
  437. this.changeData(null)
  438. }
  439. } else {
  440. this.dataList = [];
  441. }
  442. });
  443. },
  444. changeData(row){
  445. this.currentRow = JSON.parse(JSON.stringify(row));
  446. this.headerData=row;
  447. this.refreshCurrentTabTable ();
  448. },
  449. refreshCurrentTabTable(){
  450. if(this.currentRow===''||this.currentRow===null){
  451. this.currentRow={site:'',hsCode:'',hsCodeDesc: '',buNo:'',recordType:'',codeNo:''}
  452. }
  453. if(this.activeName==='detail'){
  454. // searchEcssCoDelNotifyDetail(this.currentRow).then(({data}) => {
  455. // //区分请求成功和失败的状况
  456. // if (data && data.code == 0) {
  457. // this.dataList2 = data.rows
  458. //
  459. // } else {
  460. // this.dataList2 = [];
  461. // }
  462. // });
  463. }
  464. },
  465. tabClick (tab, event) {
  466. // 刷新列表数据
  467. this.refreshCurrentTabTable()
  468. },
  469. getBu () {
  470. let tempData = {
  471. username: this.$store.state.user.name,
  472. }
  473. getBuList(tempData).then(({data}) => {
  474. if (data.code === 0) {
  475. this.buList = data.row2
  476. }
  477. })
  478. },
  479. addModelOpen(){
  480. this.addDisabledFlag=true
  481. this.addModel={
  482. addFlag:0,
  483. site:'',
  484. buNo:'',
  485. hsCode:'',
  486. hsCodeDesc: '',
  487. codeNo:'',
  488. unit:'',
  489. remark:'',
  490. brand:'无'
  491. }
  492. this.addModelFlag=true
  493. },
  494. updateModelOpen(row){
  495. this.addDisabledFlag=false
  496. this.addModel={
  497. addFlag:1,
  498. site:row.site,
  499. buNo:row.buNo,
  500. hsCode:row.hsCode,
  501. hsCodeDesc : row.hsCodeDesc,
  502. hsCodeDescEn : row.hsCodeDescEn,
  503. codeNo:row.codeNo,
  504. unit:row.unit,
  505. remark:row.remark,
  506. brand:row.brand || '无'
  507. }
  508. this.addModelFlag=true
  509. },
  510. deleteHsCode(row){
  511. this.$confirm('确认删除?', '提示').then(() => {
  512. deleteHsCode(row).then(({data}) => {
  513. if (data && data.code === 0) {
  514. this.searchTable()
  515. this.$message({
  516. message: '操作成功',
  517. type: 'success',
  518. duration: 1500,
  519. onClose: () => {}
  520. })
  521. } else {
  522. this.$alert(data.msg, '错误', {
  523. confirmButtonText: '确定'
  524. })
  525. }
  526. })
  527. })
  528. },
  529. saveHSCode(){
  530. if(this.addModel.buNo==null||this.addModel.buNo===''){
  531. this.$alert('请选择BU!', '错误', {
  532. confirmButtonText: '确定'
  533. })
  534. return false
  535. }
  536. if(this.addModel.hsCode==null||this.addModel.hsCode===''){
  537. this.$alert('请输入HSCode!', '错误', {
  538. confirmButtonText: '确定'
  539. })
  540. return false
  541. }
  542. if(this.addModel.hsCodeDesc==null||this.addModel.hsCodeDesc===''){
  543. this.$alert('请输入品名!', '错误', {
  544. confirmButtonText: '确定'
  545. })
  546. return false
  547. }
  548. if(this.addModel.codeNo==null||this.addModel.codeNo===''){
  549. this.$alert('请选择属性模板!', '错误', {
  550. confirmButtonText: '确定'
  551. })
  552. return false
  553. }
  554. saveHSCodeData(this.addModel).then(({data}) => {
  555. if (data && data.code === 0) {
  556. this.searchTable()
  557. this.addModelFlag = false
  558. this.$message({
  559. message: '操作成功',
  560. type: 'success',
  561. duration: 1500,
  562. onClose: () => {}
  563. })
  564. } else {
  565. this.$alert(data.msg, '错误', {
  566. confirmButtonText: '确定'
  567. })
  568. }
  569. })
  570. },
  571. },
  572. activated() {
  573. this.searchTable()
  574. },
  575. created() {
  576. this.getBu ()
  577. }
  578. }
  579. </script>
  580. <style scoped>
  581. </style>