|
@@ -2,40 +2,97 @@
|
|
|
<div id="index">
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
|
- <el-col :span="24" class="one"> 系统首页 </el-col>
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @view="toView"> </cTable>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <cDialog :dialog="dialog" @toClose="toClose">
|
|
|
+ <template v-slot:info>
|
|
|
+ <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
|
|
|
+ <cForm :span="24" :fields="formFields" :form="form" :rules="{}" :isSave="true" :disabled="true">
|
|
|
+ <template #file>
|
|
|
+ <cUpload :model="`${'file'}`" :limit="1" listType="picture-card" url="/files/travel/opinion/upload" accept="*" :list="form.file"></cUpload>
|
|
|
+ </template>
|
|
|
+ </cForm>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
+ </cDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
// 基础
|
|
|
import type { Ref } from 'vue';
|
|
|
-import { onMounted, ref } from 'vue';
|
|
|
-
|
|
|
+import { ref, onMounted, getCurrentInstance } from 'vue';
|
|
|
// 接口
|
|
|
-// import { ToolsStore } from '@/stores/tool';
|
|
|
-// import type { IQueryResult } from '@/util/types.util';
|
|
|
-// const toolsAxios = ToolsStore();
|
|
|
-
|
|
|
+import { OpinionStore } from '@/stores/problem/opinion';
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
+const opinionAxios = OpinionStore();
|
|
|
+const { proxy } = getCurrentInstance() as any;
|
|
|
// 加载中
|
|
|
const loading: Ref<any> = ref(false);
|
|
|
-
|
|
|
+let list: Ref<any> = ref([]);
|
|
|
+let total: Ref<number> = ref(0);
|
|
|
+let skip = 0;
|
|
|
+let limit: number = proxy.$limit;
|
|
|
+let fields: Ref<any[]> = ref([
|
|
|
+ { label: '用户', model: 'user.nick_name' },
|
|
|
+ { label: '手机号', model: 'phone', isSearch: true },
|
|
|
+ { label: '内容', model: 'content' }
|
|
|
+]);
|
|
|
+// 操作
|
|
|
+let opera: Ref<any[]> = ref([{ label: '查看', method: 'view' }]);
|
|
|
+// 查询数据
|
|
|
+let searchForm: Ref<any> = ref({});
|
|
|
+// 弹框
|
|
|
+const dialog: Ref<any> = ref({ title: '信息管理', show: false, type: '1' });
|
|
|
+const form: Ref<any> = ref({ file: [] });
|
|
|
+const formFields: Ref<any> = ref([
|
|
|
+ { label: '手机号', model: 'phone' },
|
|
|
+ { label: '图片', model: 'file', custom: true },
|
|
|
+ { label: '内容', model: 'content', type: 'textarea' }
|
|
|
+]);
|
|
|
// 请求
|
|
|
onMounted(async () => {
|
|
|
loading.value = true;
|
|
|
- search();
|
|
|
+ await search({ skip, limit });
|
|
|
loading.value = false;
|
|
|
});
|
|
|
-const search = async () => {
|
|
|
- // let res: IQueryResult = await toolsAxios.dataCount();
|
|
|
- // if (res.errcode == '0') {
|
|
|
- // info.value = res.data;
|
|
|
- // }
|
|
|
+const search = async (e: { skip: number; limit: number }) => {
|
|
|
+ const info = { skip: e.skip, limit: e.limit, ...searchForm.value };
|
|
|
+ const res: IQueryResult = await opinionAxios.query(info);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ list.value = res.data;
|
|
|
+ total.value = res.total;
|
|
|
+ }
|
|
|
+};
|
|
|
+const toSearch = (query: any) => {
|
|
|
+ searchForm.value = query;
|
|
|
+ search({ skip, limit });
|
|
|
+};
|
|
|
+// 查看
|
|
|
+const toView = async (data: any) => {
|
|
|
+ let res: IQueryResult = await opinionAxios.fetch(data._id);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ form.value = res.data;
|
|
|
+ dialog.value = { title: '信息管理', show: true, type: '1' };
|
|
|
+ }
|
|
|
+};
|
|
|
+// 关闭弹框
|
|
|
+const toClose = () => {
|
|
|
+ form.value = { file: [] };
|
|
|
+ dialog.value = { show: false };
|
|
|
+ search({ skip, limit });
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
.main {
|
|
|
- padding: 2px;
|
|
|
+ .two {
|
|
|
+ margin: 0 0 10px 0;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|