CzRger 1 年間 前
コミット
1cb88d661c
共有7 個のファイルを変更した294 個の追加2 個の削除を含む
  1. 8 0
      src/assets/svg/del.svg
  2. 10 0
      src/assets/svg/edit.svg
  3. 14 0
      src/assets/svg/publish.svg
  4. 10 0
      src/assets/svg/reback.svg
  5. 13 0
      src/assets/svg/view.svg
  6. 36 0
      src/style/cus.scss
  7. 203 2
      src/views/system/notice-announcement/index.vue

File diff suppressed because it is too large
+ 8 - 0
src/assets/svg/del.svg


File diff suppressed because it is too large
+ 10 - 0
src/assets/svg/edit.svg


File diff suppressed because it is too large
+ 14 - 0
src/assets/svg/publish.svg


File diff suppressed because it is too large
+ 10 - 0
src/assets/svg/reback.svg


File diff suppressed because it is too large
+ 13 - 0
src/assets/svg/view.svg


+ 36 - 0
src/style/cus.scss

@@ -19,6 +19,7 @@
   display: flex;
   overflow: hidden;
   .__normal-tree {
+    height: 100%;
   }
   .__normal-content {
     flex: 1;
@@ -285,3 +286,38 @@
     }
   }
 }
+
+
+.__cus-table_do {
+  display: flex;
+  width: 100%;
+  justify-content: center;
+  align-items: center;
+  >div {
+    margin-right: 16px;
+    font-size: 14px;
+    font-family: PingFang SC-Regular, PingFang SC;
+    font-weight: 400;
+    .svg-icon {
+      margin-right: 2px;
+    }
+  }
+  .__cus-table_do-green {
+    color: #31BF8D;
+    .svg-icon {
+      color: #31BF8D;
+    }
+  }
+  .__cus-table_do-blue {
+    color: #2EB8FF;
+    .svg-icon {
+      color: #2EB8FF;
+    }
+  }
+  .__cus-table_do-red {
+    color: #E5004F;
+    .svg-icon {
+      color: #E5004F;
+    }
+  }
+}

+ 203 - 2
src/views/system/notice-announcement/index.vue

@@ -1,4 +1,95 @@
 <template>
+  <div class="__normal-page">
+    <div class="__normal-content">
+      <CusContent
+          v-model:tableHead="tableHead"
+          @handleReset="handleReset"
+          @handleSearch="onSearch"
+      >
+        <template #fieldOut>
+          <CusForm labelWidth="100px" @handleEnter="onSearch">
+            <CusFormColumn
+                label="标题:"
+                v-model:param="queryForm.shipId"/>
+            <CusFormColumn
+                label="发布单位:"
+                v-model:param="queryForm.shipId"/>
+            <CusFormColumn
+                label="发布人:"
+                v-model:param="queryForm.shipId"/>
+            <CusFormColumn
+                label="发布时间:"
+                link="datetime"
+                type="datetimerange"
+                v-model:param="queryForm.shipId"/>
+            <CusFormColumn
+                label="类型:"
+                link="select"
+                static
+                v-model:param="queryForm.shipId"
+                labelKey="label"
+                valueKey="value"
+                :options="[
+                    {label: '类型一', value: '1'},
+                    {label: '类型二', value: '2'},
+                    {label: '类型三', value: '3'},
+                ]"/>
+            <CusFormColumn
+                label="状态:"
+                link="select"
+                static
+                v-model:param="queryForm.shipId"
+                labelKey="label"
+                valueKey="value"
+                :options="[
+                    {label: '类型一', value: '1'},
+                    {label: '类型二', value: '2'},
+                    {label: '类型三', value: '3'},
+                ]"/>
+            <CusSearchButtons
+                @handleReset="handleReset"
+                @handleSearch="onSearch"
+            />
+          </CusForm>
+        </template>
+        <template #buttons>
+          <div class="__cus-button_submit __hover">
+            <SvgIcon name="export" size="16"/>导出
+          </div>
+        </template>
+        <template #table>
+          <CusTable
+              v-loading="loading"
+              ref="ref_cusTable"
+              :tableData="queryResult.tableData"
+              :tableHead="tableHead"
+              :total="queryResult.total"
+              :page="queryPage.pageNum"
+              :pageSize="queryPage.pageSize"
+              @handlePage="handlePage"
+              @handleSort="handleSort"
+          >
+            <template #do-column-value="{ scope }">
+              <div class="__cus-table_do">
+                <div class="__cus-table_do-green __hover">
+                  <SvgIcon name="add" size="16"/>查看
+                </div>
+                <div class="__cus-table_do-blue __hover">
+                  <SvgIcon name="edit" size="16"/>编辑
+                </div>
+<!--                <div class="__cus-table_do-green __hover">-->
+<!--                  <SvgIcon name="publish" size="16"/>发布-->
+<!--                </div>-->
+                <div class="__cus-table_do-red __hover">
+                  <SvgIcon name="del" size="16"/>删除
+                </div>
+              </div>
+            </template>
+          </CusTable>
+        </template>
+      </CusContent>
+    </div>
+  </div>
 </template>
 
 <script lang="ts">
@@ -25,9 +116,119 @@ export default defineComponent({
     const router = useRouter();
     const route = useRoute();
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
-    const state = reactive({})
+    const state = reactive({
+      //  加载中
+      loading: false,
+      //  查询分页参数
+      queryPage: {
+        pageNum: 1,
+        pageSize: 10
+      },
+      //  查询结果
+      queryResult: {
+        total: 0,
+        tableData: []
+      },
+      //  查询表单参数
+      queryForm: <any>{},
+      //  查询表单参数备份
+      back_queryForm: {},
+      //  查询表格排序
+      querySort: {},
+      //  表格表头
+      tableHead: [
+        {value: "p1", label: "标题", show: true},
+        {value: "p1", label: "发布单位", show: true},
+        {value: "p1", label: "发布人", show: true},
+        {value: "p1", label: "发布时间", show: true},
+        {value: "p1", label: "类型", show: true},
+        {value: "p1", label: "状态", show: true},
+        {value: "do", label: "操作", show: true, width: 260},
+      ],
+    });
+    const ref_cusTable = ref()
+    //  获取字典
+    const initDictionary = () => {
+    }
+    //  查询分页参数改变处理方法
+    const handlePage = ({page, pageSize}: any) => {
+      state.queryPage.pageNum = page
+      state.queryPage.pageSize = pageSize
+      handleSearch(page, pageSize)
+    }
+    //  查询排序参数改变处理方法
+    const handleSort = ({key, value}: any) => {
+      state.querySort = key ? {key: value} : {}
+      handleSearch()
+    }
+    //  重置查询表单方法
+    const handleReset = () => {
+      state.queryForm = {}
+      state.back_queryForm = state.queryForm
+      handleSearch()
+    }
+    //  查询方法
+    const handleSearch = (page = 1, pageSize = 10) => {
+      //  添加分页参数
+      const queryParams: any = {
+        pageNum: page,
+        pageSize: pageSize,
+        sort: {},
+        text: ''
+      }
+      //  添加排序参数
+      for (const [k, v] of Object.entries(state.querySort)) {
+        that.$util.isValue(v) ? (queryParams.sort[k] = v) : null;
+      }
+      //  添加表单参数
+      for (const [k, v] of Object.entries(state.back_queryForm)) {
+        that.$util.isValue(v) ? (queryParams[k] = v) : null;
+      }
+      //  添加复合查询参数
+      state.loading = true
+
+      // mock
+      const arr = []
+      for (let i = 0; i < 77; i++) {
+        arr.push({p1: '阿三顶顶顶顶顶顶顶顶顶顶顶顶顶'})
+      }
+      state.queryResult.tableData = arr
+      state.queryResult.total = arr.length
+      state.loading = false
+      // that.$api.patrolBoatList(that.$util.formatGetParam(queryParams)).then((res: { code: number; rows: never[]; total: number; }) => {
+      //   if (res.code === 200) {
+      //     state.queryResult.tableData = res.rows
+      //     state.queryResult.total = res.total
+      //   }
+      //   setTimeout(() => {
+      //     state.loading = false
+      //   }, 1000)
+      // }).catch(() => {
+      //   setTimeout(() => {
+      //     state.loading = false
+      //   }, 1000)
+      // })
+    }
+    //  点击查询按钮后
+    const onSearch = () => {
+      ref_cusTable.value.resetFilter()
+      state.back_queryForm = state.queryForm
+      state.queryPage.pageNum = 1
+      handleSearch()
+    }
+    onMounted(() => {
+      state.back_queryForm = JSON.parse(JSON.stringify(state.queryForm))
+      initDictionary()
+      handleSearch()
+    })
     return {
-      ...toRefs(state)
+      ref_cusTable,
+      ...toRefs(state),
+      handleSearch,
+      handlePage,
+      handleSort,
+      handleReset,
+      onSearch,
     }
   },
 })