123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <template>
- <template-page
- ref="pageRef"
- :get-list="getList"
- :table-attributes="tableAttributes"
- :table-events="tableEvents"
- :options-evens-group="optionsEvensGroup"
- :moreParameters="moreParameters"
- :column-parsing="columnParsing"
- :exportList="exportList"
- :operation="operation()"
- >
- </template-page>
- </template>
- <script>
- import TemplatePage from '@/components/template/template-page-1.vue'
- import import_mixin from '@/components/template/import_mixin.js'
- import { workerStockList, workerStockListExport, workerStockImportM, workerStockDel } from '@/api/inventoryManagement'
- import { commonTemplateDownload } from '@/api/common.js'
- import operation_mixin from '@/components/template/operation_mixin.js'
- export default {
- components: { TemplatePage },
- mixins: [import_mixin, operation_mixin],
- data() {
- return {
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: false
- },
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- // 勾选选中行
- recordSelected: []
- }
- },
- computed: {
- // 事件组合
- optionsEvensGroup() {
- return [
- [
- [
- this.optionsEvensAuth('template', {
- click: () => {
- commonTemplateDownload({ name: '辅材师傅库存.xlsx' }, `${this.$route.meta.title}`)
- .then(res => {
- this.$message({
- message: '下载成功',
- type: 'success'
- })
- })
- .catch(err => {
- this.$message.error('下载失败')
- })
- }
- })
- ],
- [
- this.optionsEvensAuth('imp', ({ moduleName }) => {
- return {
- name: moduleName,
- render: () => {
- return this.importButton(workerStockImportM, moduleName)
- }
- }
- })
- ]
- ]
- ]
- },
- // 更多参数
- moreParameters() {
- return []
- }
- },
- methods: {
- // 列表请求函数
- getList: workerStockList,
- // 列表导出函数
- exportList: workerStockListExport,
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- return defaultData
- },
- // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- operation() {
- return this.operationBtn({
- del: {
- prompt: '此操作将永久删除数据, 是否继续?',
- click: ({ row, index, column }) => {
- workerStockDel([row.id]).then(res => {
- this.$message({
- message: '删除成功',
- type: 'success'
- })
- this.$refs?.pageRef?.refreshList()
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped></style>
|