123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <template>
- <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
- <template slot-scope="{ activeKey, data }">
- <div
- :style="{
- width: '100%',
- height: activeKey == 'list' ? '100%' : '0px',
- overflow: 'hidden'
- }"
- >
- <template-page
- ref="pageRef"
- :get-list="getList"
- :table-attributes="tableAttributes"
- :table-events="tableEvents"
- :options-evens-group="optionsEvensGroup"
- :moreParameters="moreParameters"
- :column-parsing="columnParsing"
- :operationColumnWidth="180"
- :operation="operation()"
- >
- </template-page>
- </div>
- <div
- v-if="activeKey == 'view'"
- :style="{
- width: '100%',
- height: '100%',
- overflow: 'hidden'
- }"
- >
- <template-page
- ref="pageRef2"
- :operationColumnWidth="180"
- :table-attributes="tableAttributes2"
- :table-events="tableEvents2"
- :get-list="getList2"
- :exportList="exportList2"
- :options-evens-group="optionsEvensGroup2"
- :operation="operation2()"
- :moreParameters="moreParameters2"
- expCode="exp2"
- >
- </template-page>
- </div>
- </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 operation_mixin from '@/components/template/operation_mixin.js'
- import {
- dailySummaryReduceCountList,
- dailySummaryIncrDecrCostList,
- dailySummaryIncrDecrCostImport,
- dailySummaryIncrDecrCostListExport,
- dailySummaryReduceBatchDo,
- dailySummaryReduceBatchDel,
- dailySummaryReduceCountDelete,
- dailySummaryReduceCountDo
- } from '@/api/increaseAndDecreaseExpense'
- export default {
- components: { TemplatePage },
- mixins: [import_mixin, operation_mixin],
- data() {
- return {
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: true
- },
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- // 勾选选中行
- recordSelected: [],
- // 表格属性
- tableAttributes2: {
- // 启用勾选列
- selectColumn: true
- },
- // 表格事件
- tableEvents2: {
- 'selection-change': this.selectionChange2
- },
- // 勾选选中行
- recordSelected2: [],
- // 表单
- formData: {}
- }
- },
- computed: {
- // 更多参数
- moreParameters() {
- return [
- {
- name: '工单类型',
- key: 'doStatus',
- value: '',
- conditions: [
- {
- label: '全部',
- value: ''
- },
- {
- label: '未执行',
- value: '2'
- },
- {
- label: '已执行',
- value: '1'
- }
- ]
- }
- ]
- },
- moreParameters2() {
- return [
- {
- name: '工单类型',
- key: 'doStatus',
- value: '',
- conditions: [
- {
- label: '全部',
- value: ''
- },
- {
- label: '未执行',
- value: '2'
- },
- {
- label: '已执行',
- value: '1'
- }
- ]
- }
- ]
- },
- optionsEvensGroup() {
- return [
- [
- [
- this.optionsEvensAuth('import', ({ moduleName }) => {
- return {
- name: moduleName,
- render: () => {
- return this.importButton(dailySummaryIncrDecrCostImport, moduleName)
- }
- }
- })
- ]
- ]
- ]
- },
- //
- optionsEvensGroup2() {
- return [
- [
- [
- this.optionsEvensAuth('batchExecute2', {
- click: () => {
- if (this.recordSelected2.length === 0) {
- this.$message.warning('请勾选')
- return
- }
- dailySummaryReduceBatchDo({
- ids: this.recordSelected2.map(item => item.id).join(',')
- }).then(res => {
- this.$message({ type: 'success', message: '设置成功!' })
- this.$refs.pageRef2.refreshList()
- })
- }
- })
- ],
- [
- this.optionsEvensAuth('batchDel2', {
- click: () => {
- if (this.recordSelected2.length === 0) {
- this.$message.warning('请勾选')
- return
- }
- dailySummaryReduceBatchDel({
- ids: this.recordSelected2.map(item => item.id).join(',')
- }).then(res => {
- this.$message({ type: 'success', message: '删除成功!' })
- this.$refs.pageRef2.refreshList()
- })
- }
- })
- ]
- ]
- ]
- },
- formItems() {
- return []
- }
- },
- methods: {
- // 列表请求函数
- getList(p, cb) {
- var pam = JSON.parse(JSON.stringify(p))
- try {
- if (pam.doStatus) {
- pam.params.push({ param: 'a.do_status', compare: '=', value: pam.doStatus })
- }
- cb && cb(pam)
- return dailySummaryReduceCountList(pam)
- } catch (err) {}
- },
- getList2(p, cb) {
- var pam = JSON.parse(JSON.stringify(p))
- try {
- if (pam.doStatus) {
- pam.params.push({ param: 'a.do_status', compare: '=', value: pam.doStatus })
- }
- cb && cb(pam)
- return dailySummaryIncrDecrCostList(pam)
- } catch (err) {}
- },
- // 列表导出函数
- exportList2: dailySummaryIncrDecrCostListExport,
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- return defaultData
- },
- // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- selectionChange2(data) {
- this.recordSelected2 = data
- },
- operation() {
- return this.operationBtn({
- view: {
- click: ({ row, index, column }) => {
- this.$refs.tabPage.addTab({
- // 对应显示的模块
- activeKey: 'view',
- // 唯一标识
- key: 'view',
- // 页签名称
- label: '明细',
- // 打开时事件
- triggerEvent: () => {},
- // 关闭时事件
- closeEvent: () => {}
- })
- }
- },
- execute: {
- conditions: ({ row, index, column }) => {
- return row.doStatus == '2'
- },
- prompt: '确定执行吗?',
- click: ({ row, index, column }) => {
- dailySummaryReduceCountDo({ importBatchNos: row.importBatchNo }).then(res => {
- this.$message({ type: 'success', message: '执行成功!' })
- this.$refs.pageRef.refreshList()
- })
- }
- },
- coverImport: {
- import: true,
- click: ({ row, index, column, file }) => {
- var formdata = new FormData()
- formdata.append('file', file)
- formdata.append('importBatchNo', row.importBatchNo)
- dailySummaryIncrDecrCostImport({ formdata })
- .then(res => {
- this.$refs.pageRef.refreshList()
- this.$message({
- type: 'success',
- message: '导入成功!'
- })
- })
- .catch(err => {
- this.$message({
- type: 'error',
- message: err.message || '导入失败'
- })
- })
- }
- },
- del: {
- prompt: '确定删除吗?',
- click: ({ row, index, column }) => {
- dailySummaryReduceCountDelete({ importBatchNo: row.importBatchNo }).then(res => {
- this.$message({ type: 'success', message: '删除成功!' })
- this.$refs.pageRef.refreshList()
- })
- }
- }
- })
- },
- operation2() {
- return this.operationBtn({
- execute2: {
- conditions: ({ row, index, column }) => {
- return row.doStatus == '2'
- },
- prompt: '确定执行吗?',
- click: ({ row, index, column }) => {
- dailySummaryReduceBatchDo({ ids: row.id }).then(res => {
- this.$message({ type: 'success', message: '设置成功!' })
- this.$refs.pageRef2.refreshList()
- })
- }
- },
- del2: {
- prompt: '确定删除吗?',
- click: ({ row, index, column }) => {
- dailySummaryReduceBatchDel({ ids: row.id }).then(res => {
- this.$message({ type: 'success', message: '删除成功!' })
- this.$refs.pageRef2.refreshList()
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped></style>
|