123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
- <template slot-scope="{activeKey, data}">
- <template-page v-if="activeKey == 'list'" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
- :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing" :operationColumnWidth="80"
- :operation="operation()" :exportList="exportList">
- </template-page>
- </template>
- </zj-tab-page>
- </template>
- <script>
- import TemplatePage from '@/components/template/template-page-1.vue'
- import import_mixin from '@/components/template/import_mixin.js'
- import ImageUpload from '@/components/file-upload'
- import { downloadFiles } from '@/utils/util'
- import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
- import { listPageV2, pageExport, getDetail, listImport } from "@/api/salesPurchasing/goodsCodeMachineAccount";
- import { commonTemplateDownload } from '@/api/common.js'
- import operation_mixin from '@/components/template/operation_mixin.js'
- export default {
- components: { TemplatePage, ImageUpload },
- mixins: [import_mixin, operation_mixin],
- data() {
- return {
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: true
- },
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- // 勾选选中行
- recordSelected: [],
- /** 表单变量 */
- formDialogType: 0,
- formDialogTitles: ["新增", "编辑", "详情"],
- formDialog: false,
- formData: {},
- formType: 'add',
- formVisible: false,
- id: ''
- }
- },
- computed: {
- // 事件组合
- optionsEvensGroup() {
- return [
- [
- [
- this.optionsEvensAuth("imp", {
- name: '下载导入模板',
- click: () => {
- this.handleDownload()
- }
- })
- ],
- [
- this.optionsEvensAuth("imp", {
- render: () => {
- return this.importButton(listImport, '导入模板')
- }
- })
- ]
- ],
- ]
- },
- // 更多参数
- moreParameters() {
- return []
- },
- formItems() {
- return []
- }
- },
- created(){
- if(this.$route.query.id){
- this.id = this.$route.query.id
- }
- },
- methods: {
- // 列表请求函数
- getList(p, cb) {
- try {
- var pam = JSON.parse(JSON.stringify(p))
- if(this.id){
- pam.params.push({ "param": "a.goods_material_id", "compare": "=", "value": this.id })
- }
- cb && cb(pam)
- return listPageV2(pam)
- } catch (error) {
- console.log(error)
- }
- },
- // 列表导出函数
- exportList: pageExport,
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- return defaultData
- },
- // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- operation() {
- return this.operationBtn({
- })
- },
- formCancel() {
- this.formVisible = false
- this.$refs?.formRef?.resetFields()
- this.$data.formData = this.$options.data().formData
- },
- // 下载导入模版
- handleDownload() {
- commonTemplateDownload({ name: '初始化条码.xlsx' }, `${this.$route.meta.title}`).then(res => {
- this.$message({
- message: '下载成功',
- type: 'success'
- })
- }).catch(err => {
- this.$message.error('下载失败')
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .tab {
- padding: 20px 20px 0 20px;
- }
- </style>
|