|
@@ -0,0 +1,139 @@
|
|
|
+<template>
|
|
|
+ <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="80"
|
|
|
+ :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
|
|
|
+ :operation="operation" :exportList="exportList">
|
|
|
+ </template-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 { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
|
|
|
+import { listPageV2,pageExport, getDetail, add, edit, del, getExamine } from "@/api/workOrder/rewardsPunishmentsOrder";
|
|
|
+export default {
|
|
|
+ components: { TemplatePage, ImageUpload },
|
|
|
+ mixins: [import_mixin],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 事件组合
|
|
|
+ optionsEvensGroup: [
|
|
|
+ [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ name: '新建',
|
|
|
+ click: this.addData
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ // 表格属性
|
|
|
+ tableAttributes: {
|
|
|
+ // 启用勾选列
|
|
|
+ selectColumn: false
|
|
|
+ },
|
|
|
+ // 表格事件
|
|
|
+ tableEvents: {
|
|
|
+ 'selection-change': this.selectionChange
|
|
|
+ },
|
|
|
+ // 勾选选中行
|
|
|
+ recordSelected: [],
|
|
|
+ /** 表单变量 */
|
|
|
+ formDialogType: 0,
|
|
|
+ formDialogTitles: ["新增","编辑", "详情"],
|
|
|
+ formDialog: false,
|
|
|
+ formData: {
|
|
|
+ companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ // 更多参数
|
|
|
+ moreParameters() {
|
|
|
+ return []
|
|
|
+ },
|
|
|
+ formItems() {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created(){
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 列表请求函数
|
|
|
+ getList: listPageV2,
|
|
|
+ // 列表导出函数
|
|
|
+ exportList: pageExport,
|
|
|
+ // 表格列解析渲染数据更改
|
|
|
+ columnParsing(item, defaultData) {
|
|
|
+ if (item.jname === 'fileUrl') {
|
|
|
+ defaultData.render = (h, { row, index, column }) => {
|
|
|
+ return (
|
|
|
+ <div style="padding:0 6px;cursor: pointer;">
|
|
|
+ {row.fileUrl ? row.fileUrl.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return defaultData
|
|
|
+ },
|
|
|
+ // 监听勾选变化
|
|
|
+ selectionChange(data) {
|
|
|
+ this.recordSelected = data
|
|
|
+ },
|
|
|
+ // 表格操作列
|
|
|
+ operation(h, { row, index, column }) {
|
|
|
+ return (
|
|
|
+ <div class='operation-btns'>
|
|
|
+ {row.id?<el-button type="text" onClick={() => {
|
|
|
+
|
|
|
+ }}>编辑</el-button>:null}
|
|
|
+ {!row.id?<el-button type="text" onClick={() => {
|
|
|
+
|
|
|
+ }}>保存</el-button>:null}
|
|
|
+ <el-button type="text" onClick={() => {
|
|
|
+
|
|
|
+ }}>删除</el-button>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ getExamine(){
|
|
|
+ getExamine({pageNum: 1,pageSize: -1,params: []}).then(res => {
|
|
|
+ this.examineList = res.data.records
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addData() {
|
|
|
+ this.formDialogType = 0
|
|
|
+ this.openForm()
|
|
|
+ },
|
|
|
+ openForm() {
|
|
|
+ this.formDialog = true;
|
|
|
+ },
|
|
|
+ formCancel() {
|
|
|
+ this.$refs.formRef.$refs.inlineForm.clearValidate()
|
|
|
+ this.$data.formData = this.$options.data().formData
|
|
|
+ this.formDialog = false
|
|
|
+ },
|
|
|
+ formConfirm() {
|
|
|
+ this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
|
|
|
+ if (valid) {
|
|
|
+ ([add, edit][this.formDialogType])({
|
|
|
+ ...this.formData,
|
|
|
+ fileUrl:this.formData.fileUrl.map(item=>item.url).join(",")
|
|
|
+ }).then(res => {
|
|
|
+ this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
|
|
|
+ this.formCancel()
|
|
|
+ this.$refs.pageRef.refreshList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .tab{
|
|
|
+ padding: 20px 20px 0 20px;
|
|
|
+ }
|
|
|
+</style>
|