guhongwei vor 2 Jahren
Ursprung
Commit
ac12a872b4
1 geänderte Dateien mit 143 neuen und 20 gelöschten Zeilen
  1. 143 20
      src/views/expo/achieve/trans/index.vue

+ 143 - 20
src/views/expo/achieve/trans/index.vue

@@ -2,37 +2,160 @@
   <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 #status>
+              <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </cSearch>
+        </el-col>
+        <el-col :span="24" class="thr">
+          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @exam="toExam"> </cTable>
+        </el-col>
       </el-col>
     </el-row>
+    <cDialog :dialog="dialog" @handleClose="toClose">
+      <template v-slot:info>
+        <cForm v-if="dialog.type == '1'" :span="24" :fields="formFields" :form="form" @save="onSubmit">
+          <template #status>
+            <el-option v-for="i in updateList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+          </template>
+          <template #contract>
+            <el-link :undrline="false" v-for="i in form.contract" :key="i.id" :href="i.url" target="_blank">{{ i.name }};</el-link>
+          </template>
+        </cForm>
+      </template>
+    </cDialog>
   </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 { ElMessage } from 'element-plus';
+
 // 接口
-//import { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import { DockTransStore } from '@common/src/stores/dock/dockTrans';
+import { DockStore } from '@common/src/stores/allAdmin/dock';
+import type { IQueryResult } from '@/util/types.util';
+const dockTrans = DockTransStore();
+const dictAxios = DictDataStore();
+const dock = DockStore();
+
 const { proxy } = getCurrentInstance() as any;
+
 // 加载中
-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: 'dock_id', format: (i: any) => getDict(i, 'dock_id') },
+  { label: '产品名称', model: 'product_name', isSearch: true },
+  { label: '供给者姓名', model: 's_name', isSearch: true },
+  { label: '供给者电话', model: 's_phone', isSearch: true },
+  { label: '需求者姓名', model: 'd_name', isSearch: true },
+  { label: '需求者电话', model: 'd_phone', isSearch: true },
+  { label: '状态', model: 'status', format: (i: any) => getDict(i, 'status'), isSearch: true, type: 'select' }
+]);
+// 操作
+let opera: Ref<any[]> = ref([{ label: '审核', method: 'exam', type: 'warning', display: (i: any) => i.status == '2' }]);
+
+// 查询数据
+let searchForm: Ref<any> = ref({});
+
+// 弹框
+const dialog: Ref<any> = ref({ type: '1', show: false, title: '审核管理' });
+let form: Ref<any> = ref({});
+let formFields: Ref<any[]> = ref([
+  { label: '审核状态', model: 'status', type: 'select' },
+  { label: '合同备案', model: 'contract', custom: true }
+]);
+
+// 字典表
+const statusList: Ref<any> = ref([]);
+const updateList: Ref<any> = ref([]);
+const dockList: 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: any = await dockTrans.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 == 'dock_id') {
+    if (!e) return '暂无';
+    let data: any = dockList.value.find((i: any) => i.value == e);
+    if (data && data.label) return data.title;
+    else return '暂无';
+  } else if (model == 'status') {
+    if (!e) return '暂无';
+    let data: any = statusList.value.find((i: any) => i.value == e);
+    if (data && data.label) return data.label;
+    else return '暂无';
+  }
+};
+
+// 审核
+const toExam = (data) => {
+  updateList.value = statusList.value;
+  form.value = data;
+  dialog.value = { type: '1', show: true, title: '审核管理' };
+};
+// 提交
+const onSubmit = async (data) => {
+  let res: IQueryResult;
+  if (data._id) res = await dockTrans.update(data);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `维护审核信息成功` });
+    toClose();
+  }
+};
+// 弹框关闭
+const toClose = () => {
+  form.value = {};
+  searchForm.value = {};
+  dialog.value = { title: '信息管理', show: false, type: '1' };
+  search({ skip, limit });
+};
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 状态
+  res = await dictAxios.query({ type: 'dock_trans_status' });
+  if (res.errcode == 0) statusList.value = res.data;
+  // 展会
+  res = await dock.query({});
+  if (res.errcode == '0') dockList.value = res.data;
+};
 </script>
-<style scoped lang="scss"></style>
+<style lang="scss" scoped>
+.main {
+  .one {
+    margin: 0 0 10px 0;
+  }
+  .two {
+    margin: 0 0 10px 0;
+  }
+}
+</style>