linwenxin vor 7 Monaten
Ursprung
Commit
ee183d390d

+ 207 - 163
src/views/mallManagement/storage/index.vue

@@ -1,34 +1,56 @@
 <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"
-			  :operation="operation()" :exportList="exportList">
-			</template-page>
-			<div v-if="~['add', 'edit', 'detail'].indexOf(activeKey)">
-				<zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-				  <zj-form-module title="" label-width="100px" :showPackUp="false"
-				    :form-data="formData" :form-items="formItems">
-				  </zj-form-module>
-				</zj-form-container>
-				<div slot="footer" class="dialog-footer">
-				  <el-button size="mini" @click="data.removeTab()">取 消</el-button>
-				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
-				</div>
-			</div>
-		</template>
-	</zj-tab-page>
+  <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"
+        :operation="operation()"
+        :exportList="exportList"
+      >
+      </template-page>
+      <div v-if="~['add', 'edit', 'detail'].indexOf(activeKey)">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            title=""
+            label-width="100px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+          <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
+        </div>
+      </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 { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
-import { storageListPageV2, storagePageExport, addStorage, deleteStorage, editStorage, getStorageDetail, getWebsitList } from "@/api/storage";
+import {
+  storageListPageV2,
+  storagePageExport,
+  addStorage,
+  deleteStorage,
+  editStorage,
+  getStorageDetail,
+  getWebsitList
+} from '@/api/storage'
 import operation_mixin from '@/components/template/operation_mixin.js'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin,operation_mixin],
+  mixins: [import_mixin, operation_mixin],
   data() {
     return {
       // 表格属性
@@ -44,7 +66,7 @@ export default {
       recordSelected: [],
       /** 表单变量 */
       formDialogType: 0,
-      formDialogTitles: ["新增", "编辑"],
+      formDialogTitles: ['新增', '编辑'],
       formDialog: false,
       formData: {
         storageName: '',
@@ -54,106 +76,124 @@ export default {
         type: [],
         websitId: '',
         websitName: '',
-        isDefault: false,
+        isDefault: false
       },
-			formType: 'add',
-			formVisible: false,
+      formType: 'add',
+      formVisible: false,
       websitList: [],
-      joinCode: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
+      joinCode: JSON.parse(localStorage.getItem('greemall_user')).joinCode
     }
   },
   computed: {
-	// 事件组合
-	optionsEvensGroup() {
-		return [
-			[
-				[
-					this.optionsEvensAuth("add", {
-						click: () => {
-							this.openForm('add')
-						}
-					})
-				],
-			]
-		]
-	},
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.openForm('add')
+              }
+            })
+          ]
+        ]
+      ]
+    },
     // 更多参数
     moreParameters() {
       return []
     },
     formItems() {
-      return [{
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '仓储名称',
-          prop: 'storageName',
-          rules: [...required]
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '仓储电话',
-          prop: 'storageMobile',
-          rules: [...mobile]
-        }
-      }, {
-        md: 12,
-        isShow: true,
-        name: 'el-input',
-        attributes: { placeholder: '请输入' },
-        formItemAttributes: {
-          label: '仓储地址',
-          prop: 'storageAddress',
-          rules: []
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-checkbox',
-        options: [
-          {value: '商品', label: '商品', disabled: this.formDialogType == 1 || this.formData.type.indexOf('辅材') >= 0 || this.formData.type.indexOf('配件') >= 0}, 
-          {value: '辅材', label: '辅材', disabled: this.formDialogType == 1 || this.formData.type.indexOf('商品') >= 0}, 
-          {value: '配件', label: '配件', disabled: this.formDialogType == 1 || this.formData.type.indexOf('商品') >= 0}],
-        // attributes: { disabled: this.formDialogType == 1 },
-        formItemAttributes: {
-          label: '仓储属性',
-          prop: 'type',
-          rules: this.joinCode == 'NO' ? [] : [...required]
+      return [
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '仓储名称',
+            prop: 'storageName',
+            rules: [...required]
+          }
         },
-      }, {
-        md: 6,
-        isShow: this.formData.type.length > 0 && this.formData.type.indexOf('商品') < 0,
-        name: 'el-select',
-        options: this.websitList,
-        attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 1 },
-        formItemAttributes: {
-          label: '所属网点',
-          prop: 'websitId',
-          rules: [...required]
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '仓储电话',
+            prop: 'storageMobile',
+            rules: [...mobile]
+          }
         },
-        events: {
-          change: () => {
-            this.formData.websitName = this.websitList.find(o => o.value == this.formData.websitId).label;
+        {
+          md: 12,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: {
+            label: '仓储地址',
+            prop: 'storageAddress',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-checkbox',
+          options: [
+            {
+              value: '辅材',
+              label: '辅材',
+              disabled: this.formDialogType == 1 || this.formData.type.indexOf('商品') >= 0
+            },
+            {
+              value: '配件',
+              label: '配件',
+              disabled: this.formDialogType == 1 || this.formData.type.indexOf('商品') >= 0
+            }
+          ],
+          // attributes: { disabled: this.formDialogType == 1 },
+          formItemAttributes: {
+            label: '仓储属性',
+            prop: 'type',
+            rules: this.joinCode == 'NO' ? [] : [...required]
           }
-        }
-      }, {
-        md: 6,
-        isShow: true,
-        name: 'el-radio',
-        options: [{value: true, label: '启用'}, {value: false, label: '禁用'}],
-        attributes: { disabled: this.formData.isDefault },
-        formItemAttributes: {
-          label: '状态',
-          prop: 'status',
-          rules: [...required]
         },
-      }]
+        {
+          md: 6,
+          isShow: this.formData.type.length > 0 && this.formData.type.indexOf('商品') < 0,
+          name: 'el-select',
+          options: this.websitList,
+          attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 1 },
+          formItemAttributes: {
+            label: '所属网点',
+            prop: 'websitId',
+            rules: [...required]
+          },
+          events: {
+            change: () => {
+              this.formData.websitName = this.websitList.find(o => o.value == this.formData.websitId).label
+            }
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            { value: true, label: '启用' },
+            { value: false, label: '禁用' }
+          ],
+          attributes: { disabled: this.formData.isDefault },
+          formItemAttributes: {
+            label: '状态',
+            prop: 'status',
+            rules: [...required]
+          }
+        }
+      ]
     }
   },
   methods: {
@@ -169,42 +209,42 @@ export default {
     selectionChange(data) {
       this.recordSelected = data
     },
-	// 表格操作列
-	operation() {
-		return this.operationBtn({
-			edit: {
-				btnType: 'text',
-				click: ({ row, index, column }) => {
-					this.openForm('edit',row.storageId)
-				}
-			},
-			del: {
-				btnType: 'text',
-				prompt: '确定删除吗?',
-				click: ({ row, index, column }) => {
-					deleteStorage({ storageId: row.storageId }).then(() => {
-					  this.$message({ type: 'success', message: '删除成功!' })
-					  this.$refs.pageRef.refreshList()
-					})
-				}
-			}
-		})
-	},
+    // 表格操作列
+    operation() {
+      return this.operationBtn({
+        edit: {
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openForm('edit', row.storageId)
+          }
+        },
+        del: {
+          btnType: 'text',
+          prompt: '确定删除吗?',
+          click: ({ row, index, column }) => {
+            deleteStorage({ storageId: row.storageId }).then(() => {
+              this.$message({ type: 'success', message: '删除成功!' })
+              this.$refs.pageRef.refreshList()
+            })
+          }
+        }
+      })
+    },
     // 打开 新增编辑 网点表单
     openForm(type, id) {
-    	this.$refs.tabPage.addTab({
-    		// 对应显示的模块
-    		activeKey: type,
-    		// 唯一标识
-    		key: type,
-    		// 页签名称
-    		label: ({ edit: "编辑", add: "新增" })[type],
-    		// 打开时事件
-    		triggerEvent: () => {
-    			this.formCancel()
-    			this.$nextTick(()=>{
-    				this.formType = type
-    				this.formVisible = true
+      this.$refs.tabPage.addTab({
+        // 对应显示的模块
+        activeKey: type,
+        // 唯一标识
+        key: type,
+        // 页签名称
+        label: { edit: '编辑', add: '新增' }[type],
+        // 打开时事件
+        triggerEvent: () => {
+          this.formCancel()
+          this.$nextTick(() => {
+            this.formType = type
+            this.formVisible = true
             getWebsitList({
               status: 1,
               type: 'C'
@@ -214,23 +254,25 @@ export default {
                 value: item.websitId,
                 data: item
               }))
+              if (this.websitList.length) {
+                this.formData.websitId = this.websitList[0].websitId
+                this.formData.websitName = this.websitList[0].websitName
+              }
             })
-    				if (type == 'add') {
-    					this.formDialogType = 0
-    				} else if(type == 'edit'){
-    					this.formDialogType = 1
-    					getStorageDetail({ id }).then(res => {
-                res.data.type = res.data.type.split(',');
-    					  Object.assign(this.formData, res.data)
-    					})
-    				}
-    			})
-    		},
-    		// 关闭时事件
-    		closeEvent: () => {
-    		
-    		}
-    	})
+            if (type == 'add') {
+              this.formDialogType = 0
+            } else if (type == 'edit') {
+              this.formDialogType = 1
+              getStorageDetail({ id }).then(res => {
+                res.data.type = res.data.type.split(',')
+                Object.assign(this.formData, res.data)
+              })
+            }
+          })
+        },
+        // 关闭时事件
+        closeEvent: () => {}
+      })
     },
     formCancel() {
       this.formVisible = false
@@ -240,11 +282,13 @@ export default {
     formConfirm(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          ([addStorage, editStorage][this.formDialogType])({...this.formData, type: this.formData.type.join(',')}).then(res => {
-            this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
-            cancel('list')
-            this.$refs.pageRef.refreshList()
-          })
+          ;[addStorage, editStorage]
+            [this.formDialogType]({ ...this.formData, type: this.formData.type.join(',') })
+            .then(res => {
+              this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
         }
       })
     }

+ 565 - 475
src/views/setting/notification/announcement/index.vue

@@ -1,50 +1,73 @@
 <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"
-					:operationColumnWidth="200" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
-					:column-parsing="columnParsing" :operation="operation" :exportList="exportList">
-					<div slot="moreSearch">
-						<el-radio-group v-model="status" size="mini" @change="changeType">
-							<el-radio-button label="">全部</el-radio-button>
-							<el-radio-button label="NO">未发布</el-radio-button>
-							<el-radio-button label="YES">已发布</el-radio-button>
-						</el-radio-group>
-						<br><br>
-					</div>
-				</template-page>
-			</div>
-			<div v-if="~['add', 'edit'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
-				<zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-					<zj-form-module :title="data.label" label-width="100px" :showPackUp="false" :form-data="formData"
-						:form-items="formItems">
-					</zj-form-module>
-				</zj-form-container>
-				<div slot="footer" class="dialog-footer">
-					<el-button size="mini" @click="data.removeTab()">取 消</el-button>
-					<el-button v-if="formDialogType < 2" size="mini" type="primary"
-						@click="formConfirm('NO', data.removeTab)">保存</el-button>
-					<el-button v-if="formDialogType < 2" size="mini" type="primary"
-						@click="formConfirm('YES', data.removeTab)">发布</el-button>
-				</div>
-			</div>
-			<div v-if="~['detail'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
-				<zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-					<zj-form-module :title="data.label" label-width="100px" :showPackUp="false" :form-data="formData"
-						:form-items="formItems2">
-					</zj-form-module>
-				</zj-form-container>
-				<div slot="footer" class="dialog-footer">
-					<el-button size="mini" @click="data.removeTab()">取 消</el-button>
-				</div>
-			</div>
-		</template>
-	</zj-tab-page>
+  <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"
+          :operationColumnWidth="200"
+          :options-evens-group="optionsEvensGroup"
+          :moreParameters="moreParameters"
+          :column-parsing="columnParsing"
+          :operation="operation"
+          :exportList="exportList"
+        >
+          <div slot="moreSearch">
+            <el-radio-group v-model="status" size="mini" @change="changeType">
+              <el-radio-button label="">全部</el-radio-button>
+              <el-radio-button label="NO">未发布</el-radio-button>
+              <el-radio-button label="YES">已发布</el-radio-button>
+            </el-radio-group>
+            <br /><br />
+          </div>
+        </template-page>
+      </div>
+      <div v-if="~['add', 'edit'].indexOf(activeKey)" style="box-sizing: border-box; padding: 16px">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            :title="data.label"
+            label-width="100px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+          <el-button v-if="formDialogType < 2" size="mini" type="primary" @click="formConfirm('NO', data.removeTab)"
+            >保存</el-button
+          >
+          <el-button v-if="formDialogType < 2" size="mini" type="primary" @click="formConfirm('YES', data.removeTab)"
+            >发布</el-button
+          >
+        </div>
+      </div>
+      <div v-if="~['detail'].indexOf(activeKey)" style="box-sizing: border-box; padding: 16px">
+        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+          <zj-form-module
+            :title="data.label"
+            label-width="100px"
+            :showPackUp="false"
+            :form-data="formData"
+            :form-items="formItems2"
+          >
+          </zj-form-module>
+        </zj-form-container>
+        <div slot="footer" class="dialog-footer">
+          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+        </div>
+      </div>
+    </template>
+  </zj-tab-page>
 </template>
 
 <script>
@@ -52,436 +75,503 @@ 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 } from '@/components/template/rules_verify.js'
-import { noticeListPageV2, noticePageExport, getNoticeDetail, noticeAdd, noticeUpdate, noticeDel } from "@/api/announcement";
-import { memberListPageV2 } from "@/api/masterManagement";
-import { getMemberList } from "@/api/member";
-import { getList as getListaa } from "@/api/merchant";
+import {
+  noticeListPageV2,
+  noticePageExport,
+  getNoticeDetail,
+  noticeAdd,
+  noticeUpdate,
+  noticeDel
+} from '@/api/announcement'
+import { memberListPageV2 } from '@/api/masterManagement'
+import { getMemberList } from '@/api/member'
+import { getList as getListaa } from '@/api/merchant'
 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,
-			formData: {
-				type: "A",
-				title: "",
-				files: [],
-				adminWebsitIds: [],
-				adminNickName: "",
-				workerIds: [],
-				content: "",
-			},
-			status: '',
-			websitList: [],
-			workerList: []
-		}
-	},
-	computed: {
-		// 更多参数
-		moreParameters() {
-			return []
-		},
-		formItems() {
-			return [{
-				md: 24,
-				isShow: true,
-				name: 'el-radio',
-				options: [
-					{
-						label: `活动`,
-						value: "A"
-					},
-					{
-						label: `公告`,
-						value: "B"
-					}],
-				attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 2 },
-				formItemAttributes: {
-					label: '类型',
-					prop: 'type',
-					rules: [...required]
-				},
-			},
-			{
-				md: 24,
-				isShow: true,
-				name: 'el-input',
-				attributes: { placeholder: '请输入', disabled: this.formDialogType == 2 },
-				formItemAttributes: {
-					label: '标题',
-					prop: 'title',
-					rules: [...required]
-				}
-			},
-			{
-				md: 24,
-				isShow: this.formDialogType < 2 && JSON.parse(localStorage.getItem("greemall_user")).type == 2,
-				name: 'zj-paging-pull-down',
-				options: this.websitList,
-				attributes: {
-					valueKey: "adminUserId",
-					labelKey: "companyName",
-					size: 'mini',
-					placeholder: '请选择',
-					multiple: true
-				},
-				formItemAttributes: {
-					label: '选择商户',
-					prop: 'adminWebsitIds',
-					rules: [...required]
-				}
-			},
-			{
-				md: 24,
-				isShow: this.formDialogType < 2 && JSON.parse(localStorage.getItem("greemall_user")).type != 2,
-				name: 'zj-paging-pull-down',
-				options: this.workerList,
-				attributes: {
-					valueKey: "userId",
-					labelKey: "nickName",
-					size: 'mini',
-					placeholder: '请选择',
-					multiple: true
-				},
-				formItemAttributes: {
-					label: '选择师傅',
-					prop: 'workerIds',
-					rules: [...required]
-				}
-			},
-			{
-				md: 24,
-				isShow: true,
-				name: 'slot-component',
-				formItemAttributes: {
-					label: '附件',
-					prop: 'files',
-					rules: this.formData.type == "A" ? [...required] : []
-				},
-				render: (h, { props, onInput }) => {
-					var { value } = props
-					return (
-						<ImageUpload fileList={this.formData.files} uid="idcardUpUrl_drawing_aiuh" limit={100} isEdit={this.formDialogType !== 2} />
-					)
-				}
-			},
-			{
-				md: 24,
-				isShow: true,
-				name: 'slot-component',
-				formItemAttributes: {
-					label: '内容',
-					prop: 'content',
-					rules: [...required]
-				},
-				render: (h, { props, onInput }) => {
-					var { value } = props
-					return (
-						<v-quill-editor value={value} onInput={onInput} disabled={this.formDialogType == 2} />
-					)
-				}
-			}]
-		},
-		formItems2() {
-			return [{
-				md: 24,
-				isShow: true,
-				name: 'slot-component',
-				formItemAttributes: {
-					prop: 'type',
-					label: '',
-					'label-width': "0px"
-				},
-				render: (h, { props, onInput }) => {
-					var { value } = props
-					return <div>类型:{({ A: "活动", B: "公告" })[value]}</div>
-				}
-			},
-			{
-				md: 24,
-				isShow: true,
-				name: 'slot-component',
-				attributes: { placeholder: '请输入', disabled: true },
-				formItemAttributes: {
-					prop: 'title',
-					label: '',
-					'label-width': "0px"
-				},
-				render: (h, { props, onInput }) => {
-					var { value } = props
-					return <div>标题:{value}</div>
-				}
-			},
-			{
-				md: 24,
-				isShow: true,
-				name: 'slot-component',
-				formItemAttributes: {
-					prop: 'content',
-					label: '',
-					'label-width': "0px"
-				},
-				render: (h, { props, onInput }) => {
-					var { value } = props
-					return <div domPropsInnerHTML={value}></div>
-				}
-			},
-			{
-				md: 24,
-				isShow: true,
-				name: 'slot-component',
-				formItemAttributes: {
-					prop: 'files',
-					label: '',
-					'label-width': "0px"
-				},
-				render: (h, { props, onInput }) => {
-					var { value } = props
-					return (
-						<ImageUpload fileList={this.formData.files} uid="idcardUpUrl_drawing_aiuh888" limit={100} isEdit={false} />
-					)
-				}
-			},
-			{
-				md: 24,
-				isShow: JSON.parse(localStorage.getItem("greemall_user")).type == 2,
-				name: 'slot-component',
-				formItemAttributes: {
-					prop: 'adminWebsitIds',
-					label: '',
-					'label-width': "0px"
-				},
-				render: (h, { props, onInput }) => {
-					var { value } = props
-					return <div>{this.websitList.filter(item => !!~value.indexOf(item.adminUserId)).map(item => <el-tag style="margin-right:5px">{item.companyName}</el-tag>)}</div>
-				},
-			},
-			{
-				md: 24,
-				isShow: JSON.parse(localStorage.getItem("greemall_user")).type != 2,
-				name: 'slot-component',
-				options: this.workerList,
-				formItemAttributes: {
-					prop: 'workerIds',
-					label: '',
-					'label-width': "0px"
-				},
-				render: (h, { props, onInput }) => {
-					var { value } = props
-					return <div>{this.workerList.filter(item => !!~value.indexOf(item.userId)).map(item => <el-tag style="margin-right:5px">{item.nickName}</el-tag>)}</div>
-				},
-			}]
-		}
-	},
-	created() {
-		if (this.$route.query.id) {
-			this.getNoticeDetail(this.$route.query.id, 2, 'formDialog2')
-		}
-	},
-	methods: {
-		// 切换状态
-		changeType(val) {
-			this.$refs.pageRef.refreshList()
-		},
-		// 列表请求函数
-		getList(p) {
-			try {
-				var pam = JSON.parse(JSON.stringify(p))
-				if (this.status) {
-					pam.params.push({ "param": "nr.status", "compare": "=", "value": this.status })
-				}
-				return noticeListPageV2(pam)
-			} catch (error) {
-				console.log(error)
-			}
-		},
-		// 列表导出函数
-		exportList: noticePageExport,
-		// 表格列解析渲染数据更改
-		columnParsing(item, defaultData) {
-			return defaultData
-		},
-		// 监听勾选变化
-		selectionChange(data) {
-			this.recordSelected = data
-		},
-		getNoticeDetail(noticeId, type, name) {
-			getNoticeDetail({
-				noticeId
-			}).then(res => {
-				Object.assign(this.formData, res.data, {
-					files: res.data.files ? res.data.files.map(item => ({
-						...item,
-						size: item.fileSize,
-						type: item.fileType,
-					})) : []
-				})
-				this.formDialogType = type
-				this.openForm(name)
-			})
-		},
-		// 表格操作列
-		operation(h, { row, index, column }) {
-			return (<div class='operation-btns'>
-				{row.status == "NO" ? <el-button type="text" onClick={() => {
-					this.$refs.tabPage.addTab({
-						activeKey: "edit",
-						key: "edit",
-						label: "编辑",
-						triggerEvent: () => {
-							this.formCancel()
-							this.$nextTick(() => {
-								getNoticeDetail({
-									noticeId: row.noticeId
-								}).then(res => {
-									Object.assign(this.formData, res.data, {
-										files: res.data.files ? res.data.files.map(item => ({
-											...item,
-											size: item.fileSize,
-											type: item.fileType,
-										})) : []
-									})
-									this.formDialogType = 1
-									this.openForm()
-								})
-							})
-						},
-						closeEvent: () => {
-						}
-					})
-				}}>编辑</el-button> : null}
-				<el-button type="text" onClick={() => {
-					this.$refs.tabPage.addTab({
-						activeKey: "detail",
-						key: "detail",
-						label: "查看",
-						triggerEvent: () => {
-							this.formCancel()
-							this.$nextTick(() => {
-								getNoticeDetail({
-									noticeId: row.noticeId
-								}).then(res => {
-									Object.assign(this.formData, res.data, {
-										files: res.data.files ? res.data.files.map(item => ({
-											...item,
-											size: item.fileSize,
-											type: item.fileType,
-										})) : []
-									})
-									this.formDialogType = 2
-									this.openForm()
-								})
-							})
-						},
-						closeEvent: () => {
-						}
-					})
-				}}>查看</el-button>
-				{row.status == "NO" ? <el-popconfirm
-					title={`是否确定删除?`}
-					onConfirm={() => {
-						noticeDel({
-							noticeIds: row.noticeId
-						}).then(res => {
-							this.$message({
-								type: 'success',
-								message: '删除成功!'
-							})
-							this.$refs.pageRef.refreshList()
-						})
-					}}
-				>
-					<el-button type="text" style="color: #ff0000" slot="reference">删除</el-button>
-				</el-popconfirm> : null}
-				{row.status == "YES" ? <el-button style="color: #f5680e" type="text" onClick={() => {
-					this.$router.push({
-						name: 'readRecords',
-						query: {
-							id: row.noticeId
-						}
-					})
-				}}>已读记录</el-button> : null}
-			</div>)
-		},
-		addData() {
-			this.$refs.tabPage.addTab({
-				activeKey: "add",
-				key: "add",
-				label: "新增",
-				triggerEvent: () => {
-					this.formCancel()
-					this.$nextTick(() => {
-						this.formDialogType = 0
-						this.openForm()
-					})
-				},
-				closeEvent: () => {
-				}
-			})
-		},
-		openForm() {
-			if (JSON.parse(localStorage.getItem("greemall_user")).type == 2) {
-				getListaa({ pageNum: 1, pageSize: -1, type: 1 }).then((res) => {
-					this.websitList = res.data.records
-				})
-			} else {
-				getMemberList({ "pageNum": 1, "pageSize": -1, type: "WORKER" }).then(res => {
-					this.workerList = res.data.records
-				})
-			}
-		},
-		formCancel() {
-			this.$refs?.formRef?.$refs?.inlineForm?.clearValidate()
-			this.$data.formData = this.$options.data().formData
-			this.websitList = []
-		},
-		formConfirm(status, removeTab) {
-			this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
-				if (valid) {
-					[noticeAdd, noticeUpdate][this.formDialogType]({
-						...this.formData,
-						files: this.formData.files.map(item => ({
-							...item,
-							fileSize: item.size,
-							fileType: item.type,
-						})),
-						status
-					}).then(res => {
-						this.$message({
-							type: 'success',
-							message: status == "YES" ? '发送成功!' : '保存成功!'
-						})
-						removeTab('list')
-						this.$refs.pageRef.refreshList()
-					})
-				}
-			})
-		},
-	}
+  components: { TemplatePage, ImageUpload },
+  mixins: [import_mixin],
+  data() {
+    return {
+      // 事件组合
+      optionsEvensGroup: [
+        [
+          [
+            {
+              name: '新建',
+              click: this.addData
+            }
+          ]
+        ]
+      ],
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: false
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formData: {
+        type: 'A',
+        title: '',
+        files: [],
+        adminWebsitIds: [],
+        adminNickName: '',
+        workerIds: [],
+        content: ''
+      },
+      status: '',
+      websitList: [],
+      workerList: []
+    }
+  },
+  computed: {
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+    formItems() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-radio',
+          options: [
+            {
+              label: `活动`,
+              value: 'A'
+            },
+            {
+              label: `公告`,
+              value: 'B'
+            }
+          ],
+          attributes: { filterable: true, placeholder: '请选择', disabled: this.formDialogType == 2 },
+          formItemAttributes: {
+            label: '类型',
+            prop: 'type',
+            rules: [...required]
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: this.formDialogType == 2 },
+          formItemAttributes: {
+            label: '标题',
+            prop: 'title',
+            rules: [...required]
+          }
+        },
+        {
+          md: 24,
+          isShow: this.formDialogType < 2 && JSON.parse(localStorage.getItem('greemall_user')).type == 2,
+          name: 'zj-paging-pull-down',
+          options: this.websitList,
+          attributes: {
+            valueKey: 'adminUserId',
+            labelKey: 'companyName',
+            size: 'mini',
+            placeholder: '请选择',
+            multiple: true
+          },
+          formItemAttributes: {
+            label: '选择商户',
+            prop: 'adminWebsitIds',
+            rules: [...required]
+          }
+        },
+        {
+          md: 24,
+          isShow: this.formDialogType < 2 && JSON.parse(localStorage.getItem('greemall_user')).type != 2,
+          name: 'zj-paging-pull-down',
+          options: this.workerList,
+          attributes: {
+            valueKey: 'userId',
+            labelKey: 'nickName',
+            size: 'mini',
+            placeholder: '请选择',
+            multiple: true
+          },
+          formItemAttributes: {
+            label: '选择师傅',
+            prop: 'workerIds',
+            rules: [...required]
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '附件',
+            prop: 'files',
+            rules: this.formData.type == 'A' ? [...required] : []
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <ImageUpload
+                fileList={this.formData.files}
+                uid="idcardUpUrl_drawing_aiuh"
+                limit={100}
+                isEdit={this.formDialogType !== 2}
+              />
+            )
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '内容',
+            prop: 'content',
+            rules: [...required]
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return <v-quill-editor value={value} onInput={onInput} disabled={this.formDialogType == 2} />
+          }
+        }
+      ]
+    },
+    formItems2() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            prop: 'type',
+            label: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return <div>类型:{{ A: '活动', B: '公告' }[value]}</div>
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            prop: 'title',
+            label: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return <div>标题:{value}</div>
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            prop: 'content',
+            label: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return <div domPropsInnerHTML={value}></div>
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            prop: 'files',
+            label: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <ImageUpload
+                fileList={this.formData.files}
+                uid="idcardUpUrl_drawing_aiuh888"
+                limit={100}
+                isEdit={false}
+              />
+            )
+          }
+        },
+        {
+          md: 24,
+          isShow: JSON.parse(localStorage.getItem('greemall_user')).type == 2,
+          name: 'slot-component',
+          formItemAttributes: {
+            prop: 'adminWebsitIds',
+            label: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <div>
+                {this.websitList
+                  .filter(item => !!~value.indexOf(item.adminUserId))
+                  .map(item => (
+                    <el-tag style="margin-right:5px">{item.companyName}</el-tag>
+                  ))}
+              </div>
+            )
+          }
+        },
+        {
+          md: 24,
+          isShow: JSON.parse(localStorage.getItem('greemall_user')).type != 2,
+          name: 'slot-component',
+          options: this.workerList,
+          formItemAttributes: {
+            prop: 'workerIds',
+            label: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <div>
+                {this.workerList
+                  .filter(item => !!~value.indexOf(item.userId))
+                  .map(item => (
+                    <el-tag style="margin-right:5px">{item.nickName}</el-tag>
+                  ))}
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  created() {
+    if (this.$route.query.id) {
+      this.getNoticeDetail(this.$route.query.id, 2, 'formDialog2')
+    }
+  },
+  methods: {
+    // 切换状态
+    changeType(val) {
+      this.$refs.pageRef.refreshList()
+    },
+    // 列表请求函数
+    getList(p) {
+      try {
+        var pam = JSON.parse(JSON.stringify(p))
+        if (this.status) {
+          pam.params.push({ param: 'nr.status', compare: '=', value: this.status })
+        }
+        return noticeListPageV2(pam)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 列表导出函数
+    exportList: noticePageExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+    getNoticeDetail(noticeId, type, name) {
+      getNoticeDetail({
+        noticeId
+      }).then(res => {
+        Object.assign(this.formData, res.data, {
+          files: res.data.files
+            ? res.data.files.map(item => ({
+                ...item,
+                size: item.fileSize,
+                type: item.fileType
+              }))
+            : []
+        })
+        this.formDialogType = type
+        this.openForm(name)
+      })
+    },
+    // 表格操作列
+    operation(h, { row, index, column }) {
+      return (
+        <div class="operation-btns">
+          {row.status == 'NO' ? (
+            <el-button
+              type="text"
+              onClick={() => {
+                this.$refs.tabPage.addTab({
+                  activeKey: 'edit',
+                  key: 'edit',
+                  label: '编辑',
+                  triggerEvent: () => {
+                    this.formCancel()
+                    this.$nextTick(() => {
+                      getNoticeDetail({
+                        noticeId: row.noticeId
+                      }).then(res => {
+                        Object.assign(this.formData, res.data, {
+                          files: res.data.files
+                            ? res.data.files.map(item => ({
+                                ...item,
+                                size: item.fileSize,
+                                type: item.fileType
+                              }))
+                            : []
+                        })
+                        this.formDialogType = 1
+                        this.openForm()
+                      })
+                    })
+                  },
+                  closeEvent: () => {}
+                })
+              }}
+            >
+              编辑
+            </el-button>
+          ) : null}
+          <el-button
+            type="text"
+            onClick={() => {
+              this.$refs.tabPage.addTab({
+                activeKey: 'detail',
+                key: 'detail',
+                label: '查看',
+                triggerEvent: () => {
+                  this.formCancel()
+                  this.$nextTick(() => {
+                    getNoticeDetail({
+                      noticeId: row.noticeId
+                    }).then(res => {
+                      Object.assign(this.formData, res.data, {
+                        files: res.data.files
+                          ? res.data.files.map(item => ({
+                              ...item,
+                              size: item.fileSize,
+                              type: item.fileType
+                            }))
+                          : []
+                      })
+                      this.formDialogType = 2
+                      this.openForm()
+                    })
+                  })
+                },
+                closeEvent: () => {}
+              })
+            }}
+          >
+            查看
+          </el-button>
+          {row.status == 'NO' ? (
+            <el-popconfirm
+              title={`是否确定删除?`}
+              onConfirm={() => {
+                noticeDel({
+                  noticeIds: row.noticeId
+                }).then(res => {
+                  this.$message({
+                    type: 'success',
+                    message: '删除成功!'
+                  })
+                  this.$refs.pageRef.refreshList()
+                })
+              }}
+            >
+              <el-button type="text" style="color: #ff0000" slot="reference">
+                删除
+              </el-button>
+            </el-popconfirm>
+          ) : null}
+          {row.status == 'YES' ? (
+            <el-button
+              style="color: #f5680e"
+              type="text"
+              onClick={() => {
+                this.$router.push({
+                  name: 'readRecords',
+                  query: {
+                    id: row.noticeId
+                  }
+                })
+              }}
+            >
+              已读记录
+            </el-button>
+          ) : null}
+        </div>
+      )
+    },
+    addData() {
+      this.$refs.tabPage.addTab({
+        activeKey: 'add',
+        key: 'add',
+        label: '新增',
+        triggerEvent: () => {
+          this.formCancel()
+          this.$nextTick(() => {
+            this.formDialogType = 0
+            this.openForm()
+          })
+        },
+        closeEvent: () => {}
+      })
+    },
+    openForm() {
+      if (JSON.parse(localStorage.getItem('greemall_user')).type == 2) {
+        getListaa({ pageNum: 1, pageSize: -1, type: 1 }).then(res => {
+          this.websitList = res.data.records
+        })
+      } else {
+        getMemberList({ pageNum: 1, pageSize: -1, type: 'WORKER' }).then(res => {
+          this.workerList = res.data.records
+        })
+      }
+    },
+    formCancel() {
+      this.$refs?.formRef?.$refs?.inlineForm?.clearValidate()
+      this.$data.formData = this.$options.data().formData
+      this.websitList = []
+    },
+    formConfirm(status, removeTab) {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          ;[noticeAdd, noticeUpdate]
+            [this.formDialogType]({
+              ...this.formData,
+              files: this.formData.files.map(item => ({
+                ...item,
+                fileSize: item.size,
+                fileType: item.type
+              })),
+              status
+            })
+            .then(res => {
+              this.$message({
+                type: 'success',
+                message: status == 'YES' ? '发送成功!' : '保存成功!'
+              })
+              removeTab('list')
+              this.$refs.pageRef.refreshList()
+            })
+        }
+      })
+    }
+  }
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped></style>

+ 71 - 64
src/views/setting/notification/readRecords/index.vue

@@ -1,8 +1,17 @@
 <template>
-	<template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
-		:operationColumnWidth="120" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
-		:column-parsing="columnParsing" :operation="operation" :exportList="exportList">
-	</template-page>
+  <template-page
+    ref="pageRef"
+    :get-list="getList"
+    :table-attributes="tableAttributes"
+    :table-events="tableEvents"
+    :operationColumnWidth="120"
+    :options-evens-group="optionsEvensGroup"
+    :moreParameters="moreParameters"
+    :column-parsing="columnParsing"
+    :operation="operation"
+    :exportList="exportList"
+  >
+  </template-page>
 </template>
 
 <script>
@@ -10,67 +19,65 @@ 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 } from '@/components/template/rules_verify.js'
-import { noticeListPageV2, noticePageExport } from "@/api/readRecords";
-import { getList as getListaa } from "@/api/merchant";
+import { noticeListPageV2, noticePageExport } from '@/api/readRecords'
+import { getList as getListaa } from '@/api/merchant'
 export default {
-	components: { TemplatePage, ImageUpload },
-	mixins: [import_mixin],
-	data() {
-		return {
-			// 事件组合
-			optionsEvensGroup: [],
-			// 表格属性
-			tableAttributes: {
-				// 启用勾选列
-				selectColumn: false
-			},
-			tableEvents: {},
-			noticeId: ''
-		}
-	},
-	computed: {
-		// 更多参数
-		moreParameters() {
-			return []
-		},
-		formItems() {
-			
-		}
-	},
-	created(){
-		if(this.$route.query.id){
-			this.noticeId = this.$route.query.id
-		}
-	},
-	methods: {
-		// 切换状态
-		changeType(val) {
-			this.$refs.pageRef.refreshList()
-		},
-		// 列表请求函数
-		getList(p) {
-			try {
-				var pam = JSON.parse(JSON.stringify(p))
-				if (this.noticeId) {
-					pam.params.push({ "param": "nr.notice_id", "compare": "=", "value": this.noticeId })
-				}
-				return noticeListPageV2(pam)
-			} catch (error) {
-				console.log(error)
-			}
-		},
-		// 列表导出函数
-		exportList: noticePageExport,
-		// 表格列解析渲染数据更改
-		columnParsing(item, defaultData) {
-			return defaultData
-		},
-		// 表格操作列
-		operation(h, { row, index, column }) {
-			return ''
-		}
-	}
+  components: { TemplatePage, ImageUpload },
+  mixins: [import_mixin],
+  data() {
+    return {
+      // 事件组合
+      optionsEvensGroup: [],
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: false
+      },
+      tableEvents: {},
+      noticeId: ''
+    }
+  },
+  computed: {
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+    formItems() {}
+  },
+  created() {
+    if (this.$route.query.id) {
+      this.noticeId = this.$route.query.id
+    }
+  },
+  methods: {
+    // 切换状态
+    changeType(val) {
+      this.$refs.pageRef.refreshList()
+    },
+    // 列表请求函数
+    getList(p) {
+      try {
+        var pam = JSON.parse(JSON.stringify(p))
+        if (this.noticeId) {
+          pam.params.push({ param: 'nr.notice_id', compare: '=', value: this.noticeId })
+        }
+        return noticeListPageV2(pam)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 列表导出函数
+    exportList: noticePageExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 表格操作列
+    operation(h, { row, index, column }) {
+      return ''
+    }
+  }
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped></style>