johnsen 9 месяцев назад
Родитель
Сommit
f5bdf9e09d

+ 4 - 0
.husky/pre-commit

@@ -0,0 +1,4 @@
+#!/bin/sh​
+. "$(dirname "$0")/_/husky.sh"​
+​
+npx lint-staged

+ 1 - 0
.prettierrc.json

@@ -6,6 +6,7 @@
   "singleQuote": true,
   "trailingComma": "es5",
   "bracketSpacing": true,
+  "jsxBracketSameLine": false,
   "arrowParens": "always",
   "vueIndentScriptAndStyle": true
 }

+ 25 - 31
.vscode/settings.json

@@ -1,15 +1,10 @@
 {
-  //为了符合eslint的两个空格间隔原则
+  // 编辑器基础设置
   "editor.tabSize": 2,
   //配置eslint
-  "files.autoSave": "off",
   "eslint.run": "onSave",
   // 控制是否将打开的编辑器显示为预览。预览编辑器将会重用至其被保留(例如,通过双击或编辑),且其字体样式将为斜体。
   "workbench.editor.enablePreview": false,
-  "search.exclude": {
-    "**/dist": true,
-    "**/static": true
-  },
   "workbench.colorCustomizations": {
     "activityBar.background": "#332A3A",
     "titleBar.activeBackground": "#473B52",
@@ -17,33 +12,32 @@
   },
   "eslint.enable": true,
   "editor.codeActionsOnSave": {
-    "source.fixAll": "explicit",
-    "source.fixAll.eslint": "explicit"
+    "source.fixAll.eslint": "always",
+    "source.organizeImports": "always"
   },
-  "editor.formatOnSave": false,
-  //  "rvest.vs-code-prettier-eslint"
-  "vetur.format.options.tabSize": 2,
-  "vetur.format.options.useTabs": false,
-  "vetur.format.defaultFormatterOptions": {
-    "prettier": {
-      "singleQuote": true,
-      "semi": false,
-      "trailingComma": "none",
-      "arrowParens": "avoid",
-      "printWidth": 100,
-      "bracketSpacing": true,
-      "htmlWhitespaceSensitivity": "ignore",
 
-      // 关键配置:函数名后添加空格
-      "spaceBeforeFunctionParen": true // 设置为 true 添加空格
-    },
-    "stylus-supremacy": {
-      "insertColons": false,
-      "insertSemicolons": false
-    }
+  // 文件和搜索设置
+  "files.eol": "\n",
+  "files.autoSave": "onFocusChange",
+  "search.exclude": {
+    "**/node_modules": true,
+    "**/dist": true
   },
-  // "vetur.format.defaultFormatter.js": "prettier-eslint",
-  "[javascript]": {
-    "editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
+
+  // ESLint设置
+  "eslint.validate": ["javascript", "javascriptreact", "vue"],
+  "eslint.workingDirectories": [{ "mode": "auto" }],
+
+  // Prettier设置
+  "prettier.configPath": ".prettierrc.json",
+  "prettier.requireConfig": true,
+
+  // Vetur设置
+  "vetur.format.defaultFormatter.html": "prettier",
+  "vetur.format.defaultFormatter.js": "prettier-eslint",
+  "vetur.validation.template": false, // 让ESLint处理模板校验
+  "vetur.grammar.customBlocks": {
+    "docs": "md",
+    "i18n": "json"
   }
 }

+ 3 - 4
package-lock.json

@@ -9108,10 +9108,9 @@
       "dev": true
     },
     "husky": {
-      "version": "9.1.7",
-      "resolved": "https://registry.npmmirror.com/husky/-/husky-9.1.7.tgz",
-      "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
-      "dev": true
+      "version": "7.0.4",
+      "resolved": "https://registry.npmmirror.com/husky/-/husky-7.0.4.tgz",
+      "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ=="
     },
     "iconv-lite": {
       "version": "0.4.24",

+ 1 - 1
package.json

@@ -62,6 +62,7 @@
     "hls.js": "^0.14.11",
     "hotkeys-js": "^3.8.1",
     "html2canvas": "^1.4.1",
+    "husky": "^7.0.4",
     "jquery": "^3.6.0",
     "js-base64": "^3.7.2",
     "js-cookie": "^2.2.1",
@@ -132,7 +133,6 @@
     "eslint-plugin-promise": "^4.2.1",
     "eslint-plugin-standard": "^4.0.1",
     "eslint-plugin-vue": "^6.2.2",
-    "husky": "^9.1.7",
     "increase-memory-limit": "1.0.7",
     "lint-staged": "^16.1.2",
     "sass": "1.32.13",

+ 4 - 4
src/App.vue

@@ -5,18 +5,18 @@
 </template>
 
 <script>
-  import { mapActions } from 'vuex'
   import { setLang } from '@/utils/auth'
+import { mapActions } from 'vuex'
 
   export default {
     name: 'app',
     watch: {
       '$i18n.locale': 'i18nHandle',
     },
-    created() {
+    created () {
       this.i18nHandle(this.$i18n.locale)
     },
-    mounted() {
+    mounted () {
       // 清楚缓存的设置租户ID
       this.setDesignTenantid('')
     },
@@ -24,7 +24,7 @@
       ...mapActions({
         setDesignTenantid: 'ibps/user/setDesignTenantid',
       }),
-      i18nHandle(val, oldVal) {
+      i18nHandle (val, oldVal) {
         setLang(val)
         document.querySelector('html').setAttribute('lang', val)
       },

+ 0 - 1
src/business/platform/bpmn/bpmn-js/properties-panel/provider/camunda/element-templates/CreateHelper.js

@@ -226,7 +226,6 @@ function createCamundaInOutAttrs(binding, value) {
     // camunda:out source(Expression) target
   } else {
     properties.target = value
-
     ;['source', 'sourceExpression'].forEach(function (k) {
       if (binding[k]) {
         properties[k] = binding[k]

+ 11 - 9
src/business/platform/form/formbuilder/right-aside/editors/editor-field-attachment.vue

@@ -15,8 +15,6 @@
            </br>
            或通过选择文件模板,'新增'文件
       </el-form-item>
-
-
       <el-form-item>
         <template slot="label">是否多选<help-tip prop="multiple" /></template>
         <el-switch
@@ -79,7 +77,11 @@
   </div>
 </template>
 <script>
-import { fileTypeOptions, fileStoreOptions, uploadTypeOptions } from '@/business/platform/form/constants/fieldOptions'
+import {
+  fileTypeOptions,
+  fileStoreOptions,
+  uploadTypeOptions,
+} from '@/business/platform/form/constants/fieldOptions'
 import EditorMixin from '../mixins/editor'
 
 export default {
@@ -89,7 +91,7 @@ export default {
       fileTypeOptions,
       fileStoreOptions,
       uploadTypeOptions,
-      media: this.fieldItem.field_options.media
+      media: this.fieldItem.field_options.media,
     }
   },
   computed: {
@@ -99,8 +101,8 @@ export default {
       },
       set(val) {
         this.fieldItem.field_options.media = this.media = val
-      }
-    }
+      },
+    },
   },
   watch: {
     media: {
@@ -109,8 +111,8 @@ export default {
           this.mediaValue = this.fieldItem.field_options.media = val || ''
         }
       },
-      immediate: true
-    }
-  }
+      immediate: true,
+    },
+  },
 }
 </script>

+ 144 - 146
src/views/platform/bpmn/bpmCommonStatment/edit.vue

@@ -84,171 +84,169 @@
 </template>
 
 <script>
-  import { save, get } from '@/api/platform/bpmn/bpmCommonStatment'
-  import IbpsEmployeeSelector from '@/business/platform/org/employee/selector'
-  import { actionOptions, isDefaultOptions } from './constants'
-  import ActionUtils from '@/utils/action'
+import { save, get } from '@/api/platform/bpmn/bpmCommonStatment'
+import IbpsEmployeeSelector from '@/business/platform/org/employee/selector'
+import { actionOptions, isDefaultOptions } from './constants'
+import ActionUtils from '@/utils/action'
 
-  export default {
-    components: {
-      IbpsEmployeeSelector,
+export default {
+  components: {
+    IbpsEmployeeSelector,
+  },
+  props: {
+    visible: {
+      type: Boolean,
+      default: false,
     },
-    props: {
-      visible: {
-        type: Boolean,
-        default: false,
+    readonly: {
+      type: Boolean,
+      default: false,
+    },
+    id: String,
+    title: String,
+  },
+  data() {
+    return {
+      formName: 'form',
+      formLabelWidth: '120px',
+      dialogVisible: this.visible,
+      dialogLoading: false,
+      actionOptions: actionOptions,
+      isDefaultOptions: isDefaultOptions,
+      defaultForm: {},
+      createByOptions: [],
+      form: {
+        action: 'agree',
+        isDefault: 'Y',
+        value: '',
       },
-      readonly: {
-        type: Boolean,
-        default: false,
+      rules: {
+        action: [{ required: false, message: this.$t('validate.required') }],
+        isDefault: [{ required: false, message: this.$t('validate.required') }],
+        value: [{ required: true, message: this.$t('validate.required') }],
       },
-      id: String,
-      title: String,
-    },
-    data() {
-      return {
-        formName: 'form',
-        formLabelWidth: '120px',
-        dialogVisible: this.visible,
-        dialogLoading: false,
-        actionOptions: actionOptions,
-        isDefaultOptions: isDefaultOptions,
-        defaultForm: {},
-        createByOptions: [],
-        form: {
-          action: 'agree',
-          isDefault: 'Y',
-          value: '',
-        },
-        rules: {
-          action: [{ required: false, message: this.$t('validate.required') }],
-          isDefault: [
-            { required: false, message: this.$t('validate.required') },
-          ],
-          value: [{ required: true, message: this.$t('validate.required') }],
-        },
-        toolbars: [
-          {
-            key: 'save',
-            hidden: () => {
-              return this.readonly
-            },
+      toolbars: [
+        {
+          key: 'save',
+          hidden: () => {
+            return this.readonly
           },
-          { key: 'cancel' },
-        ],
-      }
-    },
-    computed: {
-      formId() {
-        return this.id
-      },
-    },
-    watch: {
-      visible: {
-        handler: function (val, oldVal) {
-          this.dialogVisible = this.visible
         },
-        immediate: true,
+        { key: 'cancel' },
+      ],
+    }
+  },
+  computed: {
+    formId() {
+      return this.id
+    },
+  },
+  watch: {
+    visible: {
+      handler: function (val, oldVal) {
+        this.dialogVisible = this.visible
       },
+      immediate: true,
     },
-    created() {
-      this.defaultForm = JSON.parse(JSON.stringify(this.form))
+  },
+  created() {
+    this.defaultForm = JSON.parse(JSON.stringify(this.form))
+  },
+  methods: {
+    handleActionEvent({ key }) {
+      switch (key) {
+        case 'save':
+          this.handleSave()
+          break
+        case 'cancel':
+          this.closeDialog()
+          break
+        default:
+          break
+      }
     },
-    methods: {
-      handleActionEvent({ key }) {
-        switch (key) {
-          case 'save':
-            this.handleSave()
-            break
-          case 'cancel':
-            this.closeDialog()
-            break
-          default:
-            break
+    // 保存数据
+    handleSave() {
+      this.$refs[this.formName].validate((valid) => {
+        if (valid) {
+          this.saveData()
+        } else {
+          ActionUtils.saveErrorMessage()
         }
-      },
-      // 保存数据
-      handleSave() {
-        this.$refs[this.formName].validate((valid) => {
-          if (valid) {
-            this.saveData()
-          } else {
-            ActionUtils.saveErrorMessage()
-          }
-        })
-      },
-      // 提交保存数据
-      saveData() {
-        save(this.form)
-          .then((response) => {
-            this.$emit('callback', this)
-            ActionUtils.saveSuccessMessage(response.message, (rtn) => {
-              if (this.$utils.isEmpty(this.formId)) {
-                this.$refs[this.formName].resetFields()
-              }
-              if (rtn) {
-                this.closeDialog()
-              }
-            })
-          })
-          .catch((err) => {
-            console.error(err)
+      })
+    },
+    // 提交保存数据
+    saveData() {
+      save(this.form)
+        .then((response) => {
+          this.$emit('callback', this)
+          ActionUtils.saveSuccessMessage(response.message, (rtn) => {
+            if (this.$utils.isEmpty(this.formId)) {
+              this.$refs[this.formName].resetFields()
+            }
+            if (rtn) {
+              this.closeDialog()
+            }
           })
-      },
-      // 关闭当前窗口
-      closeDialog() {
-        this.$emit('close', false)
-        this.$refs[this.formName].resetFields()
-      },
-      /**
-       * 表单验证
-       */
-      formValidate() {
-        if (this.readonly) return
-        this.$nextTick(() => {
-          this.$refs[this.formName].validate(() => {})
         })
-      },
-      /**
-       * 获取表单数据
-       */
-      getFormData() {
-        if (this.$utils.isEmpty(this.formId)) {
-          // 重置表单
-          this.form = JSON.parse(JSON.stringify(this.defaultForm))
+        .catch((err) => {
+          console.error(err)
+        })
+    },
+    // 关闭当前窗口
+    closeDialog() {
+      this.$emit('close', false)
+      this.$refs[this.formName].resetFields()
+    },
+    /**
+     * 表单验证
+     */
+    formValidate() {
+      if (this.readonly) return
+      this.$nextTick(() => {
+        this.$refs[this.formName].validate(() => {})
+      })
+    },
+    /**
+     * 获取表单数据
+     */
+    getFormData() {
+      if (this.$utils.isEmpty(this.formId)) {
+        // 重置表单
+        this.form = JSON.parse(JSON.stringify(this.defaultForm))
+        this.formValidate()
+        return
+      }
+      this.dialogLoading = true
+      get({
+        id: this.formId,
+      })
+        .then((response) => {
+          this.form = response.data
           this.formValidate()
-          return
-        }
-        this.dialogLoading = true
-        get({
-          id: this.formId,
+          this.dialogLoading = false
+        })
+        .catch(() => {
+          this.dialogLoading = false
         })
-          .then((response) => {
-            this.form = response.data
-            this.formValidate()
-            this.dialogLoading = false
-          })
-          .catch(() => {
-            this.dialogLoading = false
-          })
-      },
     },
-  }
+  },
+}
 </script>
 <style lang="scss">
-  .special-dispose {
-    .el-form-item__content {
-      .el-selector {
-        .el-selector__tags {
-          margin-top: 17px;
-          .el-tag {
-            margin: 0;
-          }
-        }
-        .el-input--small {
-          display: none;
+.special-dispose {
+  .el-form-item__content {
+    .el-selector {
+      .el-selector__tags {
+        margin-top: 17px;
+        .el-tag {
+          margin: 0;
         }
       }
+      .el-input--small {
+        display: none;
+      }
     }
   }
+}
 </style>

+ 249 - 190
src/views/platform/message/inner/sent.vue

@@ -1,204 +1,263 @@
 <template>
-    <div class="receive-container">
-        <ibps-crud
-          ref="crud"
-          :height="height"
-          :data="listData"
-          :toolbars="listConfig.toolbars"
-          :search-form="listConfig.searchForm"
-          :pk-key="pkKey"
-          :columns="listConfig.columns"
-          :row-handle="listConfig.rowHandle"
-          :pagination="pagination"
-          :loading="loading"
-          :index-row="false"
-          @action-event="handleAction"
-          @sort-change="handleSortChange"
-          @pagination-change="handlePaginationChange"
-          @column-link-click="handleColumnLink"
+  <div class="receive-container">
+    <ibps-crud
+      ref="crud"
+      :height="height"
+      :data="listData"
+      :toolbars="listConfig.toolbars"
+      :search-form="listConfig.searchForm"
+      :pk-key="pkKey"
+      :columns="listConfig.columns"
+      :row-handle="listConfig.rowHandle"
+      :pagination="pagination"
+      :loading="loading"
+      :index-row="false"
+      @action-event="handleAction"
+      @sort-change="handleSortChange"
+      @pagination-change="handlePaginationChange"
+      @column-link-click="handleColumnLink"
+    >
+      <template slot="handIcon" slot-scope="scope">
+        <el-tooltip
+          v-if="!scope.row.receiverTime"
+          class="item"
+          effect="dark"
+          content="未读"
+          placement="bottom"
         >
-          <template slot="handIcon" slot-scope="scope">
-              <el-tooltip v-if="!scope.row.receiverTime" class="item" effect="dark" content="未读" placement="bottom">
-                  <i class="ibps-icon-envelope-o" />
-              </el-tooltip>
-              <el-tooltip v-else class="item" effect="dark" content="已读" placement="bottom">
-                  <i class="ibps-icon-envelope-open-o" />
-              </el-tooltip>
-              <el-tooltip v-if="scope.row.fileMsg" class="item" effect="dark" content="含附件" placement="bottom">
-                  <i class="ibps-icon-paperclip" />
-              </el-tooltip>
-          </template>
-        </ibps-crud>
-        <edit
-            :id="editId"
-            :title="title"
-            :readonly="readonly"
-            :visible="dialogFormVisible"
-            @callback="search"
-            @reply="reply"
-            @close="visible => dialogFormVisible = visible"
-        />
-    </div>
+          <i class="ibps-icon-envelope-o" />
+        </el-tooltip>
+        <el-tooltip
+          v-else
+          class="item"
+          effect="dark"
+          content="已读"
+          placement="bottom"
+        >
+          <i class="ibps-icon-envelope-open-o" />
+        </el-tooltip>
+        <el-tooltip
+          v-if="scope.row.fileMsg"
+          class="item"
+          effect="dark"
+          content="含附件"
+          placement="bottom"
+        >
+          <i class="ibps-icon-paperclip" />
+        </el-tooltip>
+      </template>
+    </ibps-crud>
+    <edit
+      :id="editId"
+      :title="title"
+      :readonly="readonly"
+      :visible="dialogFormVisible"
+      @callback="search"
+      @reply="reply"
+      @close="(visible) => (dialogFormVisible = visible)"
+    />
+  </div>
 </template>
 
 <script>
-import { querySentPageList, remove } from '@/api/platform/message/innerMessage'
-import ActionUtils from '@/utils/action'
-import FixHeight from '@/mixins/height'
-import { typeOptions, renderHeader } from './constants'
-import Edit from './detail/dialog'
+  import {
+    querySentPageList,
+    remove,
+  } from '@/api/platform/message/innerMessage'
+  import ActionUtils from '@/utils/action'
+  import FixHeight from '@/mixins/height'
+  import { typeOptions, renderHeader } from './constants'
+  import Edit from './detail/dialog'
 
-export default {
+  export default {
     components: {
-        Edit
+      Edit,
     },
     mixins: [FixHeight],
-    data () {
-        return {
-            dialogFormVisible: false, // 弹窗
-            editId: '', // 编辑dialog需要使用
-            pkKey: 'id', // 主键  如果主键不是pk需要传主键
-            icon: 'envelope',
-            title: '',
-            loading: true,
-            readonly: false,
-            height: document.clientHeight,
-            listData: [],
-            pagination: {},
-            sorts: {},
-            listConfig: {
-                toolbars: [
-                    {
-                        key: 'search'
-                    },
-                    {
-                        key: 'remove'
-                    }
-                ],
-                searchForm: {
-                    forms: [
-                        { prop: 'Q^subject_^SL', label: '主题' },
-                        { prop: 'Q^owner_^SL', label: '发送人' },
-                        {
-                            prop: 'Q^message_type_^SL',
-                            label: '消息类型',
-                            fieldType: 'select',
-                            options: typeOptions
-                        },
-                        { prop: ['Q^create_time_^DL', 'Q^create_time_^DG'], label: '发送时间', fieldType: 'daterange' }
-                    ]
-                },
-                // 表格字段配置
-                columns: [
-                    { prop: 'stateIcon', label: '', slotName: 'handIcon', renderHeader: renderHeader, width: '60' },
-                    { prop: 'subject', label: '主题', link: 'dialog', sortable: 'custom', width: '150' },
-                    { prop: 'content', label: '消息描述', minWidth: '200' },
-                    { prop: 'ownerName', label: '发送人', width: '100' },
-                    { prop: 'messageType', label: '消息类型', tags: typeOptions, width: '100' },
-                    { prop: 'createTime', label: '发送时间', dateFormat: 'yyyy-MM-dd HH:mm:ss', width: '150' }
-                ],
-                rowHandle: {
-                    actions: [{
-                        key: 'remove'
-                    }, {
-                        key: 'detail'
-                    }]
-                }
-            }
-        }
+    data() {
+      return {
+        dialogFormVisible: false, // 弹窗
+        editId: '', // 编辑dialog需要使用
+        pkKey: 'id', // 主键  如果主键不是pk需要传主键
+        icon: 'envelope',
+        title: '',
+        loading: true,
+        readonly: false,
+        height: document.clientHeight,
+        listData: [],
+        pagination: {},
+        sorts: {},
+        listConfig: {
+          toolbars: [
+            {
+              key: 'search',
+            },
+            {
+              key: 'remove',
+            },
+          ],
+          searchForm: {
+            forms: [
+              { prop: 'Q^subject_^SL', label: '主题' },
+              { prop: 'Q^owner_^SL', label: '发送人' },
+              {
+                prop: 'Q^message_type_^SL',
+                label: '消息类型',
+                fieldType: 'select',
+                options: typeOptions,
+              },
+              {
+                prop: ['Q^create_time_^DL', 'Q^create_time_^DG'],
+                label: '发送时间',
+                fieldType: 'daterange',
+              },
+            ],
+          },
+          // 表格字段配置
+          columns: [
+            {
+              prop: 'stateIcon',
+              label: '',
+              slotName: 'handIcon',
+              renderHeader: renderHeader,
+              width: '60',
+            },
+            {
+              prop: 'subject',
+              label: '主题',
+              link: 'dialog',
+              sortable: 'custom',
+              width: '150',
+            },
+            { prop: 'content', label: '消息描述', minWidth: '200' },
+            { prop: 'ownerName', label: '发送人', width: '100' },
+            {
+              prop: 'messageType',
+              label: '消息类型',
+              tags: typeOptions,
+              width: '100',
+            },
+            {
+              prop: 'createTime',
+              label: '发送时间',
+              dateFormat: 'yyyy-MM-dd HH:mm:ss',
+              width: '150',
+            },
+          ],
+          rowHandle: {
+            actions: [
+              {
+                key: 'remove',
+              },
+              {
+                key: 'detail',
+              },
+            ],
+          },
+        },
+      }
     },
-    created () {
-        this.loadData()
+    created() {
+      this.loadData()
     },
     methods: {
-        reply (id) {
-            this.editId = id
-            this.repliFormVisible = true
-        },
-        // 加载数据
-        loadData () {
-            this.loading = true
-            querySentPageList(this.getSearcFormData()).then(response => {
-                ActionUtils.handleListData(this, response.data)
-                this.loading = false
-            }).catch(() => {
-                this.loading = false
-            })
-        },
-        /**
-         * 获取格式化参数
-         */
-        getSearcFormData () {
-            return ActionUtils.formatParams(
-                this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
-                this.pagination,
-                this.sorts)
-        },
-        /**
-         * 处理分页事件
-         */
-        handlePaginationChange (page) {
-            ActionUtils.setPagination(this.pagination, page)
-            this.loadData()
-        },
-        /**
-         * 处理排序
-         */
-        handleSortChange (sort) {
-            ActionUtils.setSorts(this.sorts, sort)
-            this.loadData()
-        },
-        /**
-         * 查询
-         */
-        search () {
-            this.loadData()
-        },
-        handleColumnLink (column, row) {
-            this.handleEdit(column.id, true)
-            this.title = '发送信息明细'
-        },
-        /**
-         * 处理按钮事件
-         */
-        handleAction (command, position, selection, data) {
-            switch (command) {
-                case 'search':// 查询
-                    ActionUtils.setFirstPagination(this.pagination)
-                    this.search()
-                    break
-                case 'detail':// 明细
-                    ActionUtils.selectedRecord(selection).then((id) => {
-                        this.handleEdit(id, true)
-                        this.title = '信息明细'
-                    }).catch(() => { })
-                    break
-                case 'remove':// 删除
-                    ActionUtils.removeRecord(selection).then((ids) => {
-                        this.handleRemove(ids)
-                    }).catch(() => { })
-                    break
-                default:
-                    break
-            }
-        },
-        /**
-         * 处理明细
-         */
-        handleEdit (id = '', readonly) {
-            this.editId = id
-            this.readonly = readonly
-            this.dialogFormVisible = true
-        },
-        /**
-         * 处理删除
-         */
-        handleRemove (ids) {
-            remove({ innerMessageIds: ids }).then(response => {
-                ActionUtils.removeSuccessMessage()
-                this.search()
-            }).catch(() => {})
+      reply(id) {
+        this.editId = id
+        this.repliFormVisible = true
+      },
+      // 加载数据
+      loadData() {
+        this.loading = true
+        querySentPageList(this.getSearcFormData())
+          .then((response) => {
+            ActionUtils.handleListData(this, response.data)
+            this.loading = false
+          })
+          .catch(() => {
+            this.loading = false
+          })
+      },
+      /**
+       * 获取格式化参数
+       */
+      getSearcFormData() {
+        return ActionUtils.formatParams(
+          this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
+          this.pagination,
+          this.sorts
+        )
+      },
+      /**
+       * 处理分页事件
+       */
+      handlePaginationChange(page) {
+        ActionUtils.setPagination(this.pagination, page)
+        this.loadData()
+      },
+      /**
+       * 处理排序
+       */
+      handleSortChange(sort) {
+        ActionUtils.setSorts(this.sorts, sort)
+        this.loadData()
+      },
+      /**
+       * 查询
+       */
+      search() {
+        this.loadData()
+      },
+      handleColumnLink(column, row) {
+        this.handleEdit(column.id, true)
+        this.title = '发送信息明细'
+      },
+      /**
+       * 处理按钮事件
+       */
+      handleAction(command, position, selection, data) {
+        switch (command) {
+          case 'search': // 查询
+            ActionUtils.setFirstPagination(this.pagination)
+            this.search()
+            break
+          case 'detail': // 明细
+            ActionUtils.selectedRecord(selection)
+              .then((id) => {
+                this.handleEdit(id, true)
+                this.title = '信息明细'
+              })
+              .catch(() => {})
+            break
+          case 'remove': // 删除
+            ActionUtils.removeRecord(selection)
+              .then((ids) => {
+                this.handleRemove(ids)
+              })
+              .catch(() => {})
+            break
+          default:
+            break
         }
-    }
-}
+      },
+      /**
+       * 处理明细
+       */
+      handleEdit(id = '', readonly) {
+        this.editId = id
+        this.readonly = readonly
+        this.dialogFormVisible = true
+      },
+      /**
+       * 处理删除
+       */
+      handleRemove(ids) {
+        remove({ innerMessageIds: ids })
+          .then((response) => {
+            ActionUtils.removeSuccessMessage()
+            this.search()
+          })
+          .catch(() => {})
+      },
+    },
+  }
 </script>

Разница между файлами не показана из-за своего большого размера
+ 157 - 107
src/views/platform/system/news/cms.vue


+ 112 - 141
src/views/platform/system/news/detail.vue

@@ -1,16 +1,6 @@
 <template>
-  <el-dialog
-    :title="title"
-    :visible.sync="dialogVisible"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    width="65%"
-    top="10vh"
-    class="news-detail-dialog"
-    @open="getFormData"
-    @close="closeDialog"
-  >
+  <el-dialog :title="title" :visible.sync="dialogVisible" :close-on-click-modal="false" :close-on-press-escape="false"
+    append-to-body width="65%" top="10vh" class="news-detail-dialog" @open="getFormData" @close="closeDialog">
     <el-row style="padding: 10px 10px 0 10px; max-height: 600px">
       <el-form ref="form" :model="form" label-width="100px" disabled>
         <!-- <el-form-item label="公告分类:" prop="typeId">
@@ -34,43 +24,23 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="发布时间:" prop="publicDate">
-              <el-date-picker
-                v-model="form.publicDate"
-                type="date"
-                style="width: 100%"
-                placeholder=""
-                value-format="yyyy-MM-dd HH:mm:ss"
-              />
+              <el-date-picker v-model="form.publicDate" type="date" style="width: 100%" placeholder=""
+                value-format="yyyy-MM-dd HH:mm:ss" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="失效时间:" prop="loseDate">
-              <el-date-picker
-                v-model="form.loseDate"
-                type="date"
-                style="width: 100%"
-                placeholder=""
-                value-format="yyyy-MM-dd HH:mm:ss"
-              />
+              <el-date-picker v-model="form.loseDate" type="date" style="width: 100%" placeholder=""
+                value-format="yyyy-MM-dd HH:mm:ss" />
             </el-form-item>
           </el-col>
         </el-row>
         <el-form-item label="附件:" prop="fileAttach">
-          <ibps-attachment-selector
-            v-if="form.fileAttach"
-            :value="form.fileAttach"
-            multiple
-            readonly
-          />
+          <ibps-attachment-selector v-if="form.fileAttach" :value="form.fileAttach" multiple readonly />
           <span v-else>/</span>
         </el-form-item>
         <el-form-item label="内容:" prop="content">
-          <ibps-ueditor
-            v-model="form.content"
-            :readonly="readonly"
-            :word-limit="!readonly"
-            destroy
-          />
+          <ibps-ueditor v-model="form.content" :readonly="readonly" :word-limit="!readonly" destroy />
         </el-form-item>
       </el-form>
     </el-row>
@@ -81,119 +51,120 @@
 </template>
 
 <script>
-  import IbpsAttachmentSelector from '@/business/platform/file/attachment/selector'
-  import { get } from '@/api/platform/system/news'
-  import { typeOptions, publicItemOptions, isPublicOptions } from './constants'
-  import { getFile } from '@/utils/avatar'
-  import IbpsUeditor from '@/components/ibps-ueditor'
-  import IbpsTypeSelect from '@/business/platform/cat/type/select'
-  export default {
-    components: {
-      IbpsAttachmentSelector,
-      IbpsUeditor,
-      IbpsTypeSelect,
+import { get } from '@/api/platform/system/news'
+import IbpsTypeSelect from '@/business/platform/cat/type/select'
+import IbpsAttachmentSelector from '@/business/platform/file/attachment/selector'
+import IbpsUeditor from '@/components/ibps-ueditor'
+import { getFile } from '@/utils/avatar'
+import { isPublicOptions, publicItemOptions, typeOptions } from './constants'
+export default {
+  components: {
+    IbpsAttachmentSelector,
+    IbpsUeditor,
+    IbpsTypeSelect,
+  },
+  props: {
+    visible: {
+      type: Boolean,
+      default: false,
     },
-    props: {
-      visible: {
-        type: Boolean,
-        default: false,
-      },
-      readonly: {
-        type: Boolean,
-        default: false,
+    readonly: {
+      type: Boolean,
+      default: false,
+    },
+    id: String,
+    title: String,
+  },
+  data() {
+    return {
+      formName: 'form',
+      dialogVisible: this.visible,
+      dialogLoading: false,
+      dialogFormVisible: false, // 弹窗
+      typeOptions: typeOptions,
+      publicItemOptions: publicItemOptions,
+      isPublicOptions: isPublicOptions,
+      form: {},
+      toolbars: [{ key: 'cancel', label: '关闭' }],
+    }
+  },
+  computed: {
+    formId() {
+      return this.id
+    },
+    image() {
+      return getFile(this.form.picture)
+    },
+  },
+  watch: {
+    visible: {
+      handler: function (val, oldVal) {
+        this.dialogVisible = this.visible
       },
-      id: String,
-      title: String,
+      immediate: true,
     },
-    data() {
-      return {
-        formName: 'form',
-        dialogVisible: this.visible,
-        dialogLoading: false,
-        dialogFormVisible: false, // 弹窗
-        typeOptions: typeOptions,
-        publicItemOptions: publicItemOptions,
-        isPublicOptions: isPublicOptions,
-        form: {},
-        toolbars: [{ key: 'cancel', label: '关闭' }],
+  },
+  methods: {
+    handleActionEvent({ key }) {
+      switch (key) {
+        case 'cancel':
+          this.closeDialog()
+          break
+        default:
+          break
       }
     },
-    computed: {
-      formId() {
-        return this.id
-      },
-      image() {
-        return getFile(this.form.picture)
-      },
+    // 关闭当前窗口
+    closeDialog() {
+      this.$emit('close', false)
     },
-    watch: {
-      visible: {
-        handler: function (val, oldVal) {
-          this.dialogVisible = this.visible
-        },
-        immediate: true,
-      },
+    titleStyle(color) {
+      this.$refs.title.style.color = color
     },
-    methods: {
-      handleActionEvent({ key }) {
-        switch (key) {
-          case 'cancel':
-            this.closeDialog()
-            break
-          default:
-            break
-        }
-      },
-      // 关闭当前窗口
-      closeDialog() {
-        this.$emit('close', false)
-      },
-      titleStyle(color) {
-        this.$refs.title.style.color = color
-      },
-      /**
-       * 获取表单数据
-       */
-      getFormData() {
-        this.dialogLoading = true
-        get({
-          newsId: this.formId,
-        })
-          .then((response) => {
-            const data = response.data
-            this.form = data
-            if (response.data.publicItem === 'important') {
-              this.titleStyle('red')
-            } else {
-              this.titleStyle('black')
-            }
+    /**
+     * 获取表单数据
+     */
+    getFormData() {
+      this.dialogLoading = true
+      get({
+        newsId: this.formId,
+      })
+        .then((response) => {
+          const data = response.data
+          this.form = data
+          if (response.data.publicItem === 'important') {
+            this.titleStyle('red')
+          } else {
+            this.titleStyle('black')
+          }
 
-            this.dialogLoading = false
-          })
-          .catch(() => {
-            this.dialogLoading = false
-          })
-      },
+          this.dialogLoading = false
+        })
+        .catch(() => {
+          this.dialogLoading = false
+        })
     },
-  }
+  },
+}
 </script>
 <style lang="scss">
-  .news-detail-dialog {
-    .text-border {
-      width: 100%;
-      color: #000000;
-      box-shadow:
-        0 0 0 0 rgba(0, 0, 0, 0.1),
-        0 0 0 0 rgba(0, 0, 0, 0.1),
-        0 0 0 0 rgba(0, 0, 0, 0.1),
-        0 1px 0px 0 rgba(0, 0, 0, 0.1);
-      min-height: 38px;
-      font-size: 14px;
-      font-weight: bold;
-      text-align: center;
-    }
-    .el-dialog__body {
-      height: calc(70vh - 110px) !important;
-    }
+.news-detail-dialog {
+  .text-border {
+    width: 100%;
+    color: #000000;
+    box-shadow:
+      0 0 0 0 rgba(0, 0, 0, 0.1),
+      0 0 0 0 rgba(0, 0, 0, 0.1),
+      0 0 0 0 rgba(0, 0, 0, 0.1),
+      0 1px 0px 0 rgba(0, 0, 0, 0.1);
+    min-height: 38px;
+    font-size: 14px;
+    font-weight: bold;
+    text-align: center;
+  }
+
+  .el-dialog__body {
+    height: calc(70vh - 110px) !important;
   }
+}
 </style>

+ 318 - 350
src/views/platform/system/news/edit.vue

@@ -1,16 +1,6 @@
 <template>
-  <el-dialog
-    :title="title"
-    :visible.sync="dialogVisible"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    width="65%"
-    top="10vh"
-    custom-class="dialog"
-    @open="getform"
-    @close="closeDialog"
-  >
+  <el-dialog :title="title" :visible.sync="dialogVisible" :close-on-click-modal="false" :close-on-press-escape="false"
+    append-to-body width="65%" top="10vh" custom-class="dialog" @open="getform" @close="closeDialog">
     <el-row class="notice-container">
       <!-- <div style="padding-left:65px;">
                 <span class="photo-area" @click="dialogPictureVisible = !readonly">
@@ -35,13 +25,7 @@
                 @action-event="uploaderPictureAction"
                 @close="visible => dialogPictureVisible = visible"
             /> -->
-      <el-form
-        ref="form"
-        :rules="rules"
-        :model="form"
-        label-width="100px"
-        @submit.native.prevent
-      >
+      <el-form ref="form" :rules="rules" :model="form" label-width="100px" @submit.native.prevent>
         <!-- <el-form-item label="发布选项:" prop="publicItem">
                     <el-radio-group v-model="form.publicItem">
                         <el-radio label="notices">发布公告</el-radio>
@@ -110,44 +94,27 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="发布时间:" prop="publicDate">
-              <el-date-picker
-                v-model="form.publicDate"
-                type="date"
-                style="width: 100%"
-                placeholder="选择日期"
-                value-format="yyyy-MM-dd HH:mm:ss"
-              />
+              <el-date-picker v-model="form.publicDate" type="date" style="width: 100%" placeholder="选择日期"
+                value-format="yyyy-MM-dd HH:mm:ss" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="失效时间:" prop="loseDate">
-              <el-date-picker
-                v-model="form.loseDate"
-                type="date"
-                style="width: 100%"
-                placeholder="选择日期,不可早于发布时间"
-                value-format="yyyy-MM-dd HH:mm:ss"
-              />
+              <el-date-picker v-model="form.loseDate" type="date" style="width: 100%" placeholder="选择日期,不可早于发布时间"
+                value-format="yyyy-MM-dd HH:mm:ss" />
             </el-form-item>
           </el-col>
         </el-row>
         <el-form-item label="附件:" prop="fileAttach">
-          <ibps-attachment-selector
-            v-model="form.fileAttach"
-            accept="*"
-            multiple
-          />
+          <ibps-attachment-selector v-model="form.fileAttach" accept="*" multiple />
         </el-form-item>
         <el-form-item label="内容:" prop="content">
           <ibps-ueditor v-model="form.content" />
         </el-form-item>
       </el-form>
     </el-row>
-    <ibps-uploader
-      :visible="dialogFormVisible"
-      @action-event="uploaderAction"
-      @close="(visible) => (dialogFormVisible = visible)"
-    />
+    <ibps-uploader :visible="dialogFormVisible" @action-event="uploaderAction"
+      @close="(visible) => (dialogFormVisible = visible)" />
     <div slot="footer" class="el-dialog--center">
       <ibps-toolbar :actions="toolbars" @action-event="handleActionEvent" />
     </div>
@@ -155,347 +122,348 @@
 </template>
 
 <script>
-  import { fileUrl } from '@/api/platform/file/attachment'
-  import { save, get } from '@/api/platform/system/news'
-  import { typeOptions } from './constants'
-  import ActionUtils from '@/utils/action'
-  import { getFile } from '@/utils/avatar'
-  import IbpsTypeSelect from '@/business/platform/cat/type/select'
-  import IbpsEmployeeSelector from '@/business/platform/org/employee/selector'
-  import IbpsOrgSelector from '@/business/platform/org/org/selector'
+import { fileUrl } from '@/api/platform/file/attachment'
+import { get, save } from '@/api/platform/system/news'
+import IbpsTypeSelect from '@/business/platform/cat/type/select'
+import IbpsEmployeeSelector from '@/business/platform/org/employee/selector'
+import IbpsOrgSelector from '@/business/platform/org/org/selector'
+import ActionUtils from '@/utils/action'
+import { getFile } from '@/utils/avatar'
+import { typeOptions } from './constants'
 
-  import IbpsUploader from '@/business/platform/file/uploader'
+import IbpsUploader from '@/business/platform/file/uploader'
 
-  import IbpsUeditor from '@/components/ibps-ueditor'
-  import IbpsAttachmentSelector from '@/business/platform/file/attachment/selector'
+import IbpsAttachmentSelector from '@/business/platform/file/attachment/selector'
+import IbpsUeditor from '@/components/ibps-ueditor'
 
-  export default {
-    components: {
-      IbpsUeditor,
-      IbpsTypeSelect,
-      IbpsEmployeeSelector,
-      IbpsOrgSelector,
-      IbpsUploader,
-      IbpsAttachmentSelector,
+export default {
+  components: {
+    IbpsUeditor,
+    IbpsTypeSelect,
+    IbpsEmployeeSelector,
+    IbpsOrgSelector,
+    IbpsUploader,
+    IbpsAttachmentSelector,
+  },
+  props: {
+    visible: {
+      type: Boolean,
+      default: false,
     },
-    props: {
-      visible: {
-        type: Boolean,
-        default: false,
+    readonly: {
+      type: Boolean,
+      default: false,
+    },
+    id: String,
+    title: String,
+    status: String,
+  },
+  data() {
+    const { first = '', second = '' } = this.$store.getters.level || {}
+    const { positions = [] } = this.$store.getters.userInfo || {}
+    const position = positions.length ? positions[0] : {}
+    return {
+      limit: 1,
+      accept: '.jpeg,.gif,.png,.jpg', // 规定上传类型
+      formName: 'form',
+      dialogVisible: this.visible,
+      dialogLoading: false,
+      dialogFormVisible: false, // 弹窗
+      dialogPictureVisible: false, // 弹窗
+      typeOptions: typeOptions,
+      defaultForm: {},
+      show: '',
+      formsId: this.id,
+      form: {
+        author: '',
+        content: '',
+        createBy: '',
+        createOrgId: '',
+        createTime: '',
+        dataStatus: '',
+        dbtype: '',
+        depId: position.id,
+        depName: position.name,
+        fileAttach: '',
+        id: '',
+        ip: '',
+        public0: 'Y',
+        includeChild: 'N',
+        key: '',
+        loseDate: '',
+        name: '',
+        picture: '',
+        pk: '',
+        publicDate: this.$common.getDateNow(19),
+        publicItem: 'notices',
+        status: '',
+        tenantId: '',
+        title: '',
+        // 改字段暂时无用,改存当前层级第一级ID
+        type: second || first,
+        typeId: '',
+        updateBy: '',
+        updateTime: '',
+        userId: this.$store.getters.userId,
+        userName: this.$store.getters.name,
       },
-      readonly: {
-        type: Boolean,
-        default: false,
+      rules: {
+        typeId: [{ required: true, message: this.$t('validate.required') }],
+        title: [{ required: true, message: this.$t('validate.required') }],
+        userId: [{ required: true, message: this.$t('validate.required') }],
+        publicDate: [
+          { required: true, message: this.$t('validate.required') },
+        ],
+        content: [{ required: true, message: this.$t('validate.required') }],
       },
-      id: String,
-      title: String,
-      status: String,
-    },
-    data() {
-      const { first = '', second = '' } = this.$store.getters.level || {}
-      const { positions = [] } = this.$store.getters.userInfo || {}
-      const position = positions.length ? positions[0] : {}
-      return {
-        limit: 1,
-        accept: '.jpeg,.gif,.png,.jpg', // 规定上传类型
-        formName: 'form',
-        dialogVisible: this.visible,
-        dialogLoading: false,
-        dialogFormVisible: false, // 弹窗
-        dialogPictureVisible: false, // 弹窗
-        typeOptions: typeOptions,
-        defaultForm: {},
-        show: '',
-        formsId: this.id,
-        form: {
-          author: '',
-          content: '',
-          createBy: '',
-          createOrgId: '',
-          createTime: '',
-          dataStatus: '',
-          dbtype: '',
-          depId: position.id,
-          depName: position.name,
-          fileAttach: '',
-          id: '',
-          ip: '',
-          public0: 'Y',
-          includeChild: 'N',
-          key: '',
-          loseDate: '',
-          name: '',
-          picture: '',
-          pk: '',
-          publicDate: this.$common.getDateNow(19),
-          publicItem: 'notices',
-          status: '',
-          tenantId: '',
-          title: '',
-          // 改字段暂时无用,改存当前层级第一级ID
-          type: second || first,
-          typeId: '',
-          updateBy: '',
-          updateTime: '',
-          userId: this.$store.getters.userId,
-          userName: this.$store.getters.name,
-        },
-        rules: {
-          typeId: [{ required: true, message: this.$t('validate.required') }],
-          title: [{ required: true, message: this.$t('validate.required') }],
-          userId: [{ required: true, message: this.$t('validate.required') }],
-          publicDate: [
-            { required: true, message: this.$t('validate.required') },
-          ],
-          content: [{ required: true, message: this.$t('validate.required') }],
-        },
-        toolbars: [
-          {
-            key: 'save',
-            icon: 'ibps-icon-send',
-            label: '发布',
-            type: 'success',
-            hidden: () => {
-              return this.readonly
-            },
+      toolbars: [
+        {
+          key: 'save',
+          icon: 'ibps-icon-send',
+          label: '发布',
+          type: 'success',
+          hidden: () => {
+            return this.readonly
           },
-          {
-            key: 'drafts',
-            icon: 'ibps-icon-save',
-            label: '存为草稿',
-            hidden: () => {
-              return this.readonly
-            },
+        },
+        {
+          key: 'drafts',
+          icon: 'ibps-icon-save',
+          label: '存为草稿',
+          hidden: () => {
+            return this.readonly
           },
-          { key: 'cancel' },
-        ],
-      }
+        },
+        { key: 'cancel' },
+      ],
+    }
+  },
+  computed: {
+    formId() {
+      return this.id
     },
-    computed: {
-      formId() {
-        return this.id
-      },
-      image() {
-        return getFile(this.form.picture)
-      },
+    image() {
+      return getFile(this.form.picture)
     },
-    watch: {
-      visible: {
-        handler: function (val, oldVal) {
-          this.dialogVisible = this.visible
-        },
-        immediate: true,
+  },
+  watch: {
+    visible: {
+      handler: function (val, oldVal) {
+        this.dialogVisible = this.visible
       },
+      immediate: true,
     },
-    created() {
-      this.defaultForm = JSON.parse(JSON.stringify(this.form))
-      this.form.userId = this.$store.getters.userId
+  },
+  created() {
+    this.defaultForm = JSON.parse(JSON.stringify(this.form))
+    this.form.userId = this.$store.getters.userId
+  },
+  methods: {
+    handleActionEvent({ key }) {
+      switch (key) {
+        case 'save':
+          this.handleSave()
+          break
+        case 'drafts':
+          this.handleDrafts()
+          break
+        case 'cancel':
+          this.closeDialog()
+          break
+        default:
+          break
+      }
     },
-    methods: {
-      handleActionEvent({ key }) {
-        switch (key) {
-          case 'save':
-            this.handleSave()
-            break
-          case 'drafts':
-            this.handleDrafts()
-            break
-          case 'cancel':
-            this.closeDialog()
-            break
-          default:
-            break
-        }
-      },
-      // 选择图片附件区
-      /**
-       * 上传
-       */
-      handleUpload() {
-        this.dialogFormVisible = true
-      },
-      uploaderAction(buttonKey, data) {
-        this.dialogFormVisible = false
-        this.form.fileAttach = data.id
-      },
-      uploaderPictureAction(buttonKey, data) {
-        this.dialogPictureVisible = false
-        this.form.picture = fileUrl(data.id || data[0].id)
-      },
-      beforeAvatarUpload(file) {
-        return true
-      },
-      handleAvatarSuccess(res, file) {
-        this.form.imageUrl = URL.createObjectURL(file.raw)
-      },
-      // 填写编辑区
-      handleInput(data) {
-        this.form.userId = data.id
-        this.form.userName = data.name
-      },
-      depNameInput(data) {
-        this.form.depId = data
-      },
-      callbackDepName(data) {
-        const arr = []
-        data.forEach((i) => {
-          arr.push(i.name)
-        })
-        this.form.depName = arr.join(' ')
-      },
-      change(data) {
-        this.show = data
-      },
-      // 发布
-      handleSave() {
-        this.form.status = 'publish'
-        this.$refs[this.formName].validate((valid) => {
-          if (valid) {
-            // 置顶公告必须选择图片
-            if (this.image === '' && this.form.publicItem === 'top') {
-              ActionUtils.warning('请选择封面图片')
-            } else {
-              this.saveData()
-            }
+    // 选择图片附件区
+    /**
+     * 上传
+     */
+    handleUpload() {
+      this.dialogFormVisible = true
+    },
+    uploaderAction(buttonKey, data) {
+      this.dialogFormVisible = false
+      this.form.fileAttach = data.id
+    },
+    uploaderPictureAction(buttonKey, data) {
+      this.dialogPictureVisible = false
+      this.form.picture = fileUrl(data.id || data[0].id)
+    },
+    beforeAvatarUpload(file) {
+      return true
+    },
+    handleAvatarSuccess(res, file) {
+      this.form.imageUrl = URL.createObjectURL(file.raw)
+    },
+    // 填写编辑区
+    handleInput(data) {
+      this.form.userId = data.id
+      this.form.userName = data.name
+    },
+    depNameInput(data) {
+      this.form.depId = data
+    },
+    callbackDepName(data) {
+      const arr = []
+      data.forEach((i) => {
+        arr.push(i.name)
+      })
+      this.form.depName = arr.join(' ')
+    },
+    change(data) {
+      this.show = data
+    },
+    // 发布
+    handleSave() {
+      this.form.status = 'publish'
+      this.$refs[this.formName].validate((valid) => {
+        if (valid) {
+          // 置顶公告必须选择图片
+          if (this.image === '' && this.form.publicItem === 'top') {
+            ActionUtils.warning('请选择封面图片')
           } else {
-            ActionUtils.saveErrorMessage()
-          }
-        })
-      },
-      // 保存草稿
-      handleDrafts() {
-        this.form.status = 'drafts'
-        this.$refs[this.formName].validate((valid) => {
-          if (valid) {
             this.saveData()
-          } else {
-            ActionUtils.saveErrorMessage()
           }
-        })
-      },
-      // 保存数据
-      saveData() {
-        const data = JSON.parse(JSON.stringify(this.form))
-        data.publicDate = new Date(this.form.publicDate).getTime() || ''
-        data.loseDate = new Date(this.form.loseDate).getTime() || ''
-        // 检测失效日期是否发布日期在之前。
-        if (data.publicDate > data.loseDate && data.loseDate !== '') {
-          ActionUtils.error('发布时间与失效时间范围不合法!')
-          return
+        } else {
+          ActionUtils.saveErrorMessage()
+        }
+      })
+    },
+    // 保存草稿
+    handleDrafts() {
+      this.form.status = 'drafts'
+      this.$refs[this.formName].validate((valid) => {
+        if (valid) {
+          this.saveData()
+        } else {
+          ActionUtils.saveErrorMessage()
         }
-        save(this.form)
-          .then((response) => {
-            this.$emit('callback', this)
-            ActionUtils.saveSuccessMessage(response.message, (rtn) => {
-              if (rtn) {
-                this.closeDialog()
-              } else {
-                if (this.form.status === 'drafts') {
-                  return
-                }
-                this.form.depId = ''
-                this.form.picture = ''
-                this.$refs[this.formName].resetFields()
+      })
+    },
+    // 保存数据
+    saveData() {
+      const data = JSON.parse(JSON.stringify(this.form))
+      data.publicDate = new Date(this.form.publicDate).getTime() || ''
+      data.loseDate = new Date(this.form.loseDate).getTime() || ''
+      // 检测失效日期是否发布日期在之前。
+      if (data.publicDate > data.loseDate && data.loseDate !== '') {
+        ActionUtils.error('发布时间与失效时间范围不合法!')
+        return
+      }
+      save(this.form)
+        .then((response) => {
+          this.$emit('callback', this)
+          ActionUtils.saveSuccessMessage(response.message, (rtn) => {
+            if (rtn) {
+              this.closeDialog()
+            } else {
+              if (this.form.status === 'drafts') {
+                return
               }
-            })
-          })
-          .catch((err) => {
-            console.error(err)
+              this.form.depId = ''
+              this.form.picture = ''
+              this.$refs[this.formName].resetFields()
+            }
           })
-      },
-      // 关闭当前窗口
-      closeDialog() {
-        this.$emit('close', false)
-        this.show = ''
-        this.$refs[this.formName].resetFields()
-      },
-      /**
-       * 表单验证
-       */
-      formValidate() {
-        if (this.readonly) return
-        this.$nextTick(() => {
-          this.$refs[this.formName].validate(() => {})
         })
-      },
-      /**
-       * 获取表单数据
-       */
-      getform() {
-        this.form.userName = this.$store.getters.name
-        if (this.$utils.isEmpty(this.formId)) {
-          // 重置表单
-          const firstDate = new Date()
-          this.form.publicDate = firstDate.setDate(1)
-          this.form = JSON.parse(JSON.stringify(this.defaultForm))
+        .catch((err) => {
+          console.error(err)
+        })
+    },
+    // 关闭当前窗口
+    closeDialog() {
+      this.$emit('close', false)
+      this.show = ''
+      this.$refs[this.formName].resetFields()
+    },
+    /**
+     * 表单验证
+     */
+    formValidate() {
+      if (this.readonly) return
+      this.$nextTick(() => {
+        this.$refs[this.formName].validate(() => { })
+      })
+    },
+    /**
+     * 获取表单数据
+     */
+    getform() {
+      this.form.userName = this.$store.getters.name
+      if (this.$utils.isEmpty(this.formId)) {
+        // 重置表单
+        const firstDate = new Date()
+        this.form.publicDate = firstDate.setDate(1)
+        this.form = JSON.parse(JSON.stringify(this.defaultForm))
+        this.formValidate()
+        return
+      }
+      this.dialogLoading = true
+      get({
+        newsId: this.formId,
+      })
+        .then((response) => {
+          this.form = response.data
+          this.show = this.form.public0
           this.formValidate()
-          return
-        }
-        this.dialogLoading = true
-        get({
-          newsId: this.formId,
+          this.dialogLoading = false
+        })
+        .catch(() => {
+          this.dialogLoading = false
         })
-          .then((response) => {
-            this.form = response.data
-            this.show = this.form.public0
-            this.formValidate()
-            this.dialogLoading = false
-          })
-          .catch(() => {
-            this.dialogLoading = false
-          })
-      },
     },
-  }
+  },
+}
 </script>
 <style lang="scss">
-  .notice-container {
-    padding: 10px;
-    max-height: calc(80vh - 120px);
-  }
-  .photo-area {
+.notice-container {
+  padding: 10px;
+  max-height: calc(80vh - 120px);
+}
+
+.photo-area {
+  display: block;
+  position: relative;
+  width: 178px;
+  height: 178px;
+  z-index: 9997;
+
+  .avatar {
     display: block;
-    position: relative;
     width: 178px;
     height: 178px;
-    z-index: 9997;
-
-    .avatar {
-      display: block;
-      width: 178px;
-      height: 178px;
-    }
+  }
 
-    .handle-photo-buttons {
-      width: 100%;
-      height: 100%;
-      position: absolute;
-      top: 0;
-      background: rgba(7, 0, 0, 0.6);
-      // display: none;
-      z-index: 9998;
+  .handle-photo-buttons {
+    width: 100%;
+    height: 100%;
+    position: absolute;
+    top: 0;
+    background: rgba(7, 0, 0, 0.6);
+    // display: none;
+    z-index: 9998;
 
-      > div {
-        margin: 44% 0 0 30%;
+    >div {
+      margin: 44% 0 0 30%;
 
-        i {
-          z-index: 9999;
-          cursor: pointer;
-          margin: 0 7px;
-          color: white;
-          font-size: 18px;
-        }
+      i {
+        z-index: 9999;
+        cursor: pointer;
+        margin: 0 7px;
+        color: white;
+        font-size: 18px;
       }
     }
   }
+}
 
-  .photo-area:hover > .handle-photo-buttons {
-    display: block;
-  }
+.photo-area:hover>.handle-photo-buttons {
+  display: block;
+}
 
-  .avatar {
-    width: 178px;
-    height: 178px;
-    display: block;
-  }
+.avatar {
+  width: 178px;
+  height: 178px;
+  display: block;
+}
 </style>

+ 249 - 273
src/views/platform/system/news/list.vue

@@ -1,306 +1,282 @@
 <template>
   <div class="main-container">
-    <ibps-crud
-      ref="crud"
-      :height="height"
-      :data="listData"
-      :toolbars="listConfig.toolbars"
-      :search-form="listConfig.searchForm"
-      :pk-key="pkKey"
-      :columns="listConfig.columns"
-      display-field="通知公告"
-      :row-handle="listConfig.rowHandle"
-      :pagination="pagination"
-      :loading="loading"
-      @action-event="handleAction"
-      @sort-change="handleSortChange"
-      @pagination-change="handlePaginationChange"
-    />
+    <ibps-crud ref="crud" :height="height" :data="listData" :toolbars="listConfig.toolbars"
+      :search-form="listConfig.searchForm" :pk-key="pkKey" :columns="listConfig.columns" display-field="通知公告"
+      :row-handle="listConfig.rowHandle" :pagination="pagination" :loading="loading" @action-event="handleAction"
+      @sort-change="handleSortChange" @pagination-change="handlePaginationChange" />
     <!-- 编辑 -->
-    <edit
-      :id="editId"
-      :title="title"
-      :status="status"
-      :visible="dialogFormVisible"
-      :readonly="false"
-      @callback="search"
-      @close="(visible) => (dialogFormVisible = visible)"
-    />
+    <edit :id="editId" :title="title" :status="status" :visible="dialogFormVisible" :readonly="false" @callback="search"
+      @close="(visible) => (dialogFormVisible = visible)" />
     <!-- 明细 -->
-    <detail
-      :id="editId"
-      :title="title"
-      :visible="dialogdetailVisible"
-      :readonly="true"
-      @callback="search"
-      @close="(visible) => (dialogdetailVisible = visible)"
-    />
+    <detail :id="editId" :title="title" :visible="dialogdetailVisible" :readonly="true" @callback="search"
+      @close="(visible) => (dialogdetailVisible = visible)" />
   </div>
 </template>
 
 <script>
-  import { queryPageList, remove } from '@/api/platform/system/news'
-  import ActionUtils from '@/utils/action'
-  import FixHeight from '@/mixins/height'
-  import { publicItemOptions, isPublicOptions, typeOptions } from './constants'
-  import Edit from './edit'
-  import Detail from './detail'
+import { queryPageList, remove } from '@/api/platform/system/news'
+import FixHeight from '@/mixins/height'
+import ActionUtils from '@/utils/action'
+import { typeOptions } from './constants'
+import Detail from './detail'
+import Edit from './edit'
 
-  export default {
-    components: {
-      Edit,
-      Detail,
-    },
-    mixins: [FixHeight],
-    data() {
-      const { role = [] } = this.$store.getters.userInfo || {}
-      const roleList = ['xtgljs', 'jykfzr', 'jsfzr', 'zlfzr', 'syszr']
-      const hasRole = role.some((item) => roleList.includes(item.alias))
-      return {
-        dialogFormVisible: false, // 弹窗
-        dialogdetailVisible: false,
-        editId: '', // 编辑dialog需要使用
-        readonly: false, // 是否只读
-        pkKey: 'id', // 主键  如果主键不是pk需要传主键
-        status: '',
-        title: '',
-        loading: true,
-        height: document.clientHeight,
-        listData: [],
-        pagination: {},
-        sorts: {},
-        listConfig: {
-          toolbars: [
-            {
-              key: 'search',
+export default {
+  components: {
+    Edit,
+    Detail,
+  },
+  mixins: [FixHeight],
+  data() {
+    const { role = [] } = this.$store.getters.userInfo || {}
+    const roleList = ['xtgljs', 'jykfzr', 'jsfzr', 'zlfzr', 'syszr']
+    const hasRole = role.some((item) => roleList.includes(item.alias))
+    return {
+      dialogFormVisible: false, // 弹窗
+      dialogdetailVisible: false,
+      editId: '', // 编辑dialog需要使用
+      readonly: false, // 是否只读
+      pkKey: 'id', // 主键  如果主键不是pk需要传主键
+      status: '',
+      title: '',
+      loading: true,
+      height: document.clientHeight,
+      listData: [],
+      pagination: {},
+      sorts: {},
+      listConfig: {
+        toolbars: [
+          {
+            key: 'search',
+          },
+          {
+            key: 'add',
+            // hidden: () => {
+            //     return !hasRole
+            // }
+          },
+          {
+            key: 'remove',
+            hidden: () => {
+              return !hasRole
             },
+          },
+        ],
+        searchForm: {
+          forms: [
+            { prop: 'Q^TITLE_^SL', label: '标题' },
+            { prop: 'Q^USER_NAME_^SL', label: '发布人' },
+            { prop: 'Q^DEP_NAME_^SL', label: '发布部门' },
             {
-              key: 'add',
-              // hidden: () => {
-              //     return !hasRole
-              // }
+              prop: ['Q^PUBLIC_DATE_^DL', 'Q^PUBLIC_DATE_^DG'],
+              label: '发布时间',
+              fieldType: 'daterange',
             },
             {
-              key: 'remove',
-              hidden: () => {
-                return !hasRole
-              },
+              prop: 'Q^STATUS_^SL',
+              label: '发布状态',
+              fieldType: 'select',
+              options: typeOptions,
             },
           ],
-          searchForm: {
-            forms: [
-              { prop: 'Q^TITLE_^SL', label: '标题' },
-              { prop: 'Q^USER_NAME_^SL', label: '发布人' },
-              { prop: 'Q^DEP_NAME_^SL', label: '发布部门' },
-              {
-                prop: ['Q^PUBLIC_DATE_^DL', 'Q^PUBLIC_DATE_^DG'],
-                label: '发布时间',
-                fieldType: 'daterange',
-              },
-              {
-                prop: 'Q^STATUS_^SL',
-                label: '发布状态',
-                fieldType: 'select',
-                options: typeOptions,
-              },
-            ],
+        },
+        // 表格字段配置
+        columns: [
+          { prop: 'title', label: '标题', minWidth: 250 },
+          // { prop: 'publicItem', label: '发布选项', tags: publicItemOptions },
+          { prop: 'depName', label: '发布部门', width: 120 },
+          { prop: 'userName', label: '发布人', width: 120 },
+          {
+            prop: 'publicDate',
+            label: '发布时间',
+            dateFormat: 'yyyy-MM-dd',
+            sortable: 'custom',
+            width: 120,
+          },
+          {
+            prop: 'loseDate',
+            label: '失效时间',
+            dateFormat: 'yyyy-MM-dd',
+            sortable: 'custom',
+            width: 120,
           },
-          // 表格字段配置
-          columns: [
-            { prop: 'title', label: '标题', minWidth: 250 },
-            // { prop: 'publicItem', label: '发布选项', tags: publicItemOptions },
-            { prop: 'depName', label: '发布部门', width: 120 },
-            { prop: 'userName', label: '发布人', width: 120 },
+          // { prop: 'public0', label: '是否公共', tags: isPublicOptions },
+          {
+            prop: 'status',
+            label: '发布状态',
+            tags: typeOptions,
+            sortable: 'custom',
+            width: 100,
+          },
+          // { prop: 'depName', label: '发布范围' }
+        ],
+        rowHandle: {
+          actions: [
             {
-              prop: 'publicDate',
-              label: '发布时间',
-              dateFormat: 'yyyy-MM-dd',
-              sortable: 'custom',
-              width: 120,
+              key: 'edit',
+              hidden: (row, index) => {
+                return row.status === 'publish' || row.status === 'expired'
+              },
             },
             {
-              prop: 'loseDate',
-              label: '失效时间',
-              dateFormat: 'yyyy-MM-dd',
-              sortable: 'custom',
-              width: 120,
+              key: 'remove',
+              hidden: (row, index) => {
+                return row.status === 'publish' || row.status === 'expired'
+              },
             },
-            // { prop: 'public0', label: '是否公共', tags: isPublicOptions },
             {
-              prop: 'status',
-              label: '发布状态',
-              tags: typeOptions,
-              sortable: 'custom',
-              width: 100,
+              key: 'detail',
             },
-            // { prop: 'depName', label: '发布范围' }
           ],
-          rowHandle: {
-            actions: [
-              {
-                key: 'edit',
-                hidden: (row, index) => {
-                  return row.status === 'publish' || row.status === 'expired'
-                },
-              },
-              {
-                key: 'remove',
-                hidden: (row, index) => {
-                  return row.status === 'publish' || row.status === 'expired'
-                },
-              },
-              {
-                key: 'detail',
-              },
-            ],
-          },
         },
-      }
+      },
+    }
+  },
+  created() {
+    this.loadData()
+  },
+  methods: {
+    // 加载数据
+    loadData() {
+      this.loading = true
+      queryPageList(this.getSearcFormData())
+        .then((response) => {
+          ActionUtils.handleListData(this, response.data)
+          this.loading = false
+        })
+        .catch(() => {
+          this.loading = false
+        })
     },
-    created() {
+    /**
+     * 获取格式化参数
+     */
+    getSearcFormData() {
+      const { first = '', second = '' } = this.$store.getters.level || {}
+      const params = this.$refs['crud']
+        ? this.$refs['crud'].getSearcFormData()
+        : {}
+      params['Q^type_^SL'] = second || first
+      return ActionUtils.formatParams(params, this.pagination, this.sorts)
+    },
+    /**
+     * 处理分页事件
+     */
+    handlePaginationChange(page) {
+      ActionUtils.setPagination(this.pagination, page)
       this.loadData()
     },
-    methods: {
-      // 加载数据
-      loadData() {
-        this.loading = true
-        queryPageList(this.getSearcFormData())
-          .then((response) => {
-            ActionUtils.handleListData(this, response.data)
-            this.loading = false
-          })
-          .catch(() => {
-            this.loading = false
-          })
-      },
-      /**
-       * 获取格式化参数
-       */
-      getSearcFormData() {
-        const { first = '', second = '' } = this.$store.getters.level || {}
-        const params = this.$refs['crud']
-          ? this.$refs['crud'].getSearcFormData()
-          : {}
-        params['Q^type_^SL'] = second || first
-        return ActionUtils.formatParams(params, this.pagination, this.sorts)
-      },
-      /**
-       * 处理分页事件
-       */
-      handlePaginationChange(page) {
-        ActionUtils.setPagination(this.pagination, page)
-        this.loadData()
-      },
-      /**
-       * 处理排序
-       */
-      handleSortChange(sort) {
-        ActionUtils.setSorts(this.sorts, sort)
-        this.loadData()
-      },
-      /**
-       * 查询
-       */
-      search() {
-        this.loadData()
-      },
-      /**
-       * 处理按钮事件
-       */
-      handleAction(command, position, selection, data) {
-        switch (command) {
-          case 'search': // 查询
-            ActionUtils.setFirstPagination(this.pagination)
-            this.search()
-            break
-          case 'add': // 添加
-            this.handleEdit()
-            this.title = '添加公告'
-            break
-          case 'edit': // 编辑
-            ActionUtils.selectedRecord(selection)
-              .then((id) => {
-                this.handleEdit(id)
-                this.title = '编辑'
-                this.status = data.status
-              })
-              .catch(() => {})
-            break
-          case 'detail': // 明细
-            ActionUtils.selectedRecord(selection)
-              .then((id) => {
-                this.handleDetail(id, true)
-                this.title = '公告明细'
-              })
-              .catch(() => {})
-            break
-          case 'remove': // 删除
-            ActionUtils.removeRecord(selection)
-              .then((ids) => {
-                this.handleRemove(ids)
-              })
-              .catch(() => {})
-            break
-          default:
-            break
-        }
-      },
-      /**
-       * 处理编辑
-       */
-      handleEdit(id = '', readonly = false) {
-        this.editId = id
-        this.readonly = readonly
-        this.dialogFormVisible = true
-      },
-      /**
-       * 处理明细
-       */
-      handleDetail(id = '', readonly = false) {
-        this.editId = id
-        this.readonly = readonly
-        this.dialogdetailVisible = true
-      },
-      /**
-       * 处理删除
-       */
-      handleRemove(ids) {
-        // 获取数据
-        remove({ newsIds: ids })
-          .then((response) => {
-            ActionUtils.removeSuccessMessage()
-            this.search()
-          })
-          .catch(() => {})
-      },
-      /**
-       * 处理展示发布组织
-       */
-      handleDepName(value) {
-        // 获取数据
-        let className
-        const arr = value.split(',')
-        if (this.$utils.isEmpty(arr)) {
-          className = null
-        } else if (arr.length > 2) {
-          className = 'table-row-depNames'
-        }
-        return className
-      },
+    /**
+     * 处理排序
+     */
+    handleSortChange(sort) {
+      ActionUtils.setSorts(this.sorts, sort)
+      this.loadData()
     },
-  }
+    /**
+     * 查询
+     */
+    search() {
+      this.loadData()
+    },
+    /**
+     * 处理按钮事件
+     */
+    handleAction(command, position, selection, data) {
+      switch (command) {
+        case 'search': // 查询
+          ActionUtils.setFirstPagination(this.pagination)
+          this.search()
+          break
+        case 'add': // 添加
+          this.handleEdit()
+          this.title = '添加公告'
+          break
+        case 'edit': // 编辑
+          ActionUtils.selectedRecord(selection)
+            .then((id) => {
+              this.handleEdit(id)
+              this.title = '编辑'
+              this.status = data.status
+            })
+            .catch(() => { })
+          break
+        case 'detail': // 明细
+          ActionUtils.selectedRecord(selection)
+            .then((id) => {
+              this.handleDetail(id, true)
+              this.title = '公告明细'
+            })
+            .catch(() => { })
+          break
+        case 'remove': // 删除
+          ActionUtils.removeRecord(selection)
+            .then((ids) => {
+              this.handleRemove(ids)
+            })
+            .catch(() => { })
+          break
+        default:
+          break
+      }
+    },
+    /**
+     * 处理编辑
+     */
+    handleEdit(id = '', readonly = false) {
+      this.editId = id
+      this.readonly = readonly
+      this.dialogFormVisible = true
+    },
+    /**
+     * 处理明细
+     */
+    handleDetail(id = '', readonly = false) {
+      this.editId = id
+      this.readonly = readonly
+      this.dialogdetailVisible = true
+    },
+    /**
+     * 处理删除
+     */
+    handleRemove(ids) {
+      // 获取数据
+      remove({ newsIds: ids })
+        .then((response) => {
+          ActionUtils.removeSuccessMessage()
+          this.search()
+        })
+        .catch(() => { })
+    },
+    /**
+     * 处理展示发布组织
+     */
+    handleDepName(value) {
+      // 获取数据
+      let className
+      const arr = value.split(',')
+      if (this.$utils.isEmpty(arr)) {
+        className = null
+      } else if (arr.length > 2) {
+        className = 'table-row-depNames'
+      }
+      return className
+    },
+  },
+}
 </script>
 <style lang="scss">
-  .table-row-depName {
-    input {
-      display: none;
-    }
+.table-row-depName {
+  input {
+    display: none;
   }
-  .table-row-depNames {
-    .el-selector__tags {
-      position: relative !important;
-      -webkit-transform: translateY(10%) !important;
-      transform: translateY(10%) !important;
-    }
+}
+
+.table-row-depNames {
+  .el-selector__tags {
+    position: relative !important;
+    -webkit-transform: translateY(10%) !important;
+    transform: translateY(10%) !important;
   }
+}
 </style>

Некоторые файлы не были показаны из-за большого количества измененных файлов