|
@@ -2,37 +2,138 @@
|
|
|
<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">
|
|
|
+ <template #type>
|
|
|
+ <el-option v-for="i in typeList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #organ_id>
|
|
|
+ <el-option v-for="i in organList" :key="i._id" :label="i.name" :value="i._id"></el-option>
|
|
|
+ </template>
|
|
|
+ </cSearch>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @view="toView" @succ="toSucc"></cTable>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
-<script setup lang="ts">
|
|
|
-// 基础
|
|
|
+<script lang="ts" setup>
|
|
|
+import _ from 'lodash';
|
|
|
import type { Ref } from 'vue';
|
|
|
-// reactive,
|
|
|
-import { onMounted, ref, getCurrentInstance } from 'vue';
|
|
|
+import { ref, onMounted, getCurrentInstance } from 'vue';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+
|
|
|
// 接口
|
|
|
-//import { TestStore } from '@common/src/stores/test';
|
|
|
-//import type { IQueryResult } from '@/util/types.util';
|
|
|
-//const testAxios = TestStore();
|
|
|
+import { SubscribeOrderStore } from '@common/src/stores/admins/subscribeOrder';
|
|
|
+import { SubscribeOrganStore } from '@common/src/stores/admins/subscribeOrgan';
|
|
|
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
+const orderAxios = SubscribeOrderStore();
|
|
|
+const orgaAxios = SubscribeOrganStore();
|
|
|
+const dictAxios = DictDataStore();
|
|
|
+
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
+
|
|
|
+// 路由
|
|
|
+const router = useRouter();
|
|
|
+
|
|
|
// 加载中
|
|
|
-const loading: Ref<any> = ref(false);
|
|
|
-// 分页数据
|
|
|
-// const skip = 0;
|
|
|
-// const limit = proxy.limit;;
|
|
|
-// 请求
|
|
|
+const loading = 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: 'type', format: (i) => getDict(i, 'type'), isSearch: true, type: 'select' },
|
|
|
+ { label: '机构', model: 'organ_id', format: (i) => getDict(i, 'organ_id'), isSearch: true, type: 'select' },
|
|
|
+ { label: '服务名称', model: 'project.name', isSearch: true },
|
|
|
+ { label: '联系人', model: 'contact', isSearch: true },
|
|
|
+ { label: '手机号', model: 'phone' },
|
|
|
+ { label: '电子邮箱', model: 'email' },
|
|
|
+ { label: '服务时间', model: 'service_date' },
|
|
|
+ { label: '状态', model: 'status', format: (i) => getDict(i, 'status') }
|
|
|
+]);
|
|
|
+// 操作
|
|
|
+let opera: Ref<any[]> = ref([
|
|
|
+ { label: '查看', method: 'view' },
|
|
|
+ { label: '完成', method: 'succ', type: 'success', confirm: true, display: (i) => i.status == '0' }
|
|
|
+]);
|
|
|
+
|
|
|
+// 查询数据
|
|
|
+let searchForm: Ref<any> = ref({});
|
|
|
+
|
|
|
+// 字典表
|
|
|
+const typeList: Ref<any> = ref([]);
|
|
|
+const organList: Ref<any> = ref([]);
|
|
|
+const statusList: Ref<any> = ref([]);
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
loading.value = true;
|
|
|
- // await search({ skip, limit });
|
|
|
+ await searchOther();
|
|
|
+ await search({ skip, limit });
|
|
|
loading.value = false;
|
|
|
});
|
|
|
-//const search = async (e: { skip: number; limit: number }) => {
|
|
|
-// const info = { skip: e.skip, limit: e.limit, ...searchInfo.value };
|
|
|
-// const res: IQueryResult = await testAxios.query(info);
|
|
|
-// console.log(res);
|
|
|
-//};
|
|
|
+// 查询
|
|
|
+const search = async (e: { skip: number; limit: number }) => {
|
|
|
+ const { skip, limit } = e;
|
|
|
+ const condition = _.cloneDeep(searchForm.value);
|
|
|
+ let info = { limit: limit, skip: skip, ...condition };
|
|
|
+ let res: IQueryResult = await orderAxios.query(info);
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ list.value = res.data;
|
|
|
+ total.value = res.total;
|
|
|
+ }
|
|
|
+};
|
|
|
+const toSearch = (query) => {
|
|
|
+ searchForm.value = query;
|
|
|
+ search({ skip, limit });
|
|
|
+};
|
|
|
+const getDict = (e, model) => {
|
|
|
+ if (model == 'type') {
|
|
|
+ let data: any = typeList.value.find((i: any) => i.value == e);
|
|
|
+ if (data) return data.label;
|
|
|
+ else return '暂无';
|
|
|
+ } else if (model == 'organ_id') {
|
|
|
+ let data: any = organList.value.find((i: any) => i._id == e);
|
|
|
+ if (data) return data.name;
|
|
|
+ else return '暂无';
|
|
|
+ } else if (model == 'status') {
|
|
|
+ let data: any = statusList.value.find((i: any) => i.value == e);
|
|
|
+ if (data) return data.label;
|
|
|
+ else return '暂无';
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 修改
|
|
|
+const toView = async (data) => {
|
|
|
+ router.push({ path: '/subscribe/order/detail', query: { id: data._id } });
|
|
|
+};
|
|
|
+const toSucc = async (data) => {
|
|
|
+ data.status = '1';
|
|
|
+ let res: IQueryResult = await orderAxios.update(data);
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ ElMessage({ type: `success`, message: `服务完成` });
|
|
|
+ search({ skip, limit });
|
|
|
+ } else {
|
|
|
+ ElMessage({ type: `error`, message: `${res.errmsg}` });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const searchOther = async () => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ // 服务类型
|
|
|
+ res = await dictAxios.query({ type: 'subscribe_type' });
|
|
|
+ if (res.errcode == '0') typeList.value = res.data;
|
|
|
+ // 机构
|
|
|
+ res = await orgaAxios.query({ is_use: '0' });
|
|
|
+ if (res.errcode == '0') organList.value = res.data;
|
|
|
+ // 状态
|
|
|
+ res = await dictAxios.query({ type: 'subscribe_status' });
|
|
|
+ if (res.errcode == '0') statusList.value = res.data;
|
|
|
+};
|
|
|
</script>
|
|
|
-<style scoped lang="scss"></style>
|
|
|
+<style lang="scss" scoped></style>
|