Browse Source

修改设置

zs 1 năm trước cách đây
mục cha
commit
45fcea78fe
3 tập tin đã thay đổi với 221 bổ sung14 xóa
  1. 174 0
      src/views/order/detail.vue
  2. 8 9
      src/views/order/index.vue
  3. 39 5
      src/views/system/buy/index.vue

+ 174 - 0
src/views/order/detail.vue

@@ -0,0 +1,174 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          <cSearch :is_back="true" @toBack="toBack"></cSearch>
+        </el-col>
+        <el-col :span="24" class="two">
+          <cForm :span="24" :fields="fields" :form="form" :rules="rules" @save="toSave" label-width="auto">
+            <template #gender>
+              <el-option v-for="i in genderList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #role>
+              <el-option v-for="i in roleList" :key="i.code" :label="i.name" :value="i.code"></el-option>
+            </template>
+            <template #street>
+              <el-option @click="toChange(i)" v-for="i in streetList" :key="i._id" :label="i.name" :value="i._id"></el-option>
+            </template>
+            <template #community>
+              <el-option v-for="i in communityList" :key="i._id" :label="i.name" :value="i._id"></el-option>
+            </template>
+          </cForm>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+import { ref, reactive, onMounted } from 'vue';
+import { ElMessage } from 'element-plus';
+import type { FormRules } from 'element-plus';
+import { useRoute } from 'vue-router';
+// 接口
+import { UserStore } from '@/stores/users/user';
+import { OfficeStore } from '@/stores/office/office';
+import { RoleStore } from '@/stores/role/role'; // 角色
+import { DictDataStore } from '@/stores/dict/dictData'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const userAxios = UserStore();
+const dictAxios = DictDataStore();
+const officeAxios = OfficeStore();
+const roleAxios = RoleStore();
+// 路由
+const route = useRoute();
+// 加载中
+const loading: Ref<any> = ref(false);
+// 表单
+let form: Ref<any> = ref({});
+let fields: Ref<any[]> = ref([
+  { label: '微信用户标识', model: 'openid', options: { disabled: true } },
+  { label: '联系电话', model: 'tel' },
+  { label: '姓名', model: 'name' },
+  { label: '性别', model: 'gender', type: 'select' },
+  { label: '角色', model: 'role', type: 'select' },
+  { label: '所属街道', model: 'street', type: 'select' },
+  { label: '所属社区', model: 'community', type: 'select' }
+]);
+const rules = reactive<FormRules>({});
+// 字典表
+const genderList: Ref<any> = ref([]);
+const roleList: Ref<any> = ref([]);
+const streetList: Ref<any> = ref([]);
+const communityList: Ref<any> = ref([]);
+const statusList: Ref<any> = ref([]);
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  await searchOther();
+  await search();
+  loading.value = false;
+});
+const search = async () => {
+  let id = route.query.id;
+  if (id) {
+    let res: IQueryResult = await userAxios.fetch(id);
+    if (res.errcode == '0') {
+      let info: any = res.data as {};
+      form.value = info;
+      // 所属社区
+      res = await officeAxios.query({ belong: info.street, type: '1', is_use: '0' });
+      if (res.errcode == '0') communityList.value = res.data;
+    }
+  }
+};
+const toChange = async (val: any) => {
+  form.value.community = '';
+  let res: IQueryResult;
+  // 所属社区
+  res = await officeAxios.query({ belong: val._id, type: '1', is_use: '0' });
+  if (res.errcode == '0') communityList.value = res.data;
+};
+// 保存
+const toSave = async (data) => {
+  let res: IQueryResult;
+  if (data._id) res = await userAxios.update(data);
+  else res = await userAxios.create(data);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `维护信息成功` });
+    toBack();
+  }
+};
+// 查询其他信息
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 性别
+  res = await dictAxios.query({ type: 'gender', is_use: '0' });
+  if (res.errcode == '0') genderList.value = res.data;
+  // 角色
+  res = await roleAxios.query({ type: 'role', is_use: '0' });
+  if (res.errcode == '0') roleList.value = res.data;
+  // 所属街道
+  res = await officeAxios.query({ type: '0', is_use: '0' });
+  if (res.errcode == '0') streetList.value = res.data;
+  // 状态
+  res = await dictAxios.query({ type: 'status', is_use: '0' });
+  if (res.errcode == '0') statusList.value = res.data;
+};
+// 返回上一页
+const toBack = () => {
+  window.history.go(-1);
+};
+</script>
+<style scoped lang="scss">
+.study {
+  width: 100%;
+  .study_1 {
+    margin: 0 0 10px 0;
+    span {
+      font-size: 16px;
+    }
+    span:first-child {
+      color: #ff0000;
+    }
+  }
+  .study_2 {
+    .study_2_info {
+      width: 100%;
+      display: flex;
+      .info_1 {
+        position: relative;
+        max-width: 24%;
+        border: 1px solid #67c23a;
+        padding: 0 10px;
+        border-radius: 5px;
+        margin: 0 10px 0 0;
+        .txt {
+          position: absolute;
+          top: -15px;
+          left: 10px;
+          span {
+            display: inline-block;
+            padding: 6px 15px;
+            background: #67c23a;
+            color: #fff;
+            border-radius: 5px;
+            font-size: 16px;
+            font-weight: bold;
+            line-height: 1;
+          }
+        }
+        .info {
+          margin: 15px 0 0 0;
+          .label {
+            margin: 0 0 10px 0;
+          }
+        }
+      }
+    }
+  }
+}
+</style>

+ 8 - 9
src/views/order/index.vue

@@ -6,7 +6,7 @@
           <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" @exam="toExam"> </cTable>
+          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @view="toView"> </cTable>
         </el-col>
       </el-col>
     </el-row>
@@ -30,6 +30,7 @@ import _ from 'lodash';
 import type { Ref } from 'vue';
 import { ref, onMounted, getCurrentInstance } from 'vue';
 import { ElMessage } from 'element-plus';
+import { useRouter } from 'vue-router';
 // 接口
 import { OrderDetailStore } from '@/stores/order/orderDetail';
 import { DictDataStore } from '@/stores/dict/dictData';
@@ -39,6 +40,8 @@ const orderDetailAxios = OrderDetailStore();
 const { proxy } = getCurrentInstance() as any;
 // 加载中
 const loading: Ref<any> = ref(false);
+// 路由
+const router = useRouter();
 // 列表数据
 let list: Ref<any> = ref([]);
 let total: Ref<number> = ref(0);
@@ -54,7 +57,7 @@ let fields: Ref<any[]> = ref([
   { label: '状态', model: 'status', format: (i: any) => getDict(i, 'status') }
 ]);
 // 操作
-let opera: Ref<any[]> = ref([{ label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' }]);
+let opera: Ref<any[]> = ref([{ label: '查看', method: 'view' }]);
 // 弹框
 const dialog: Ref<any> = ref({ title: '审核管理', show: false, type: '1' });
 const form: Ref<any> = ref({ file: [] });
@@ -94,13 +97,9 @@ const getDict = (value: any, model: any) => {
     }
   }
 };
-// 审核
-const toExam = async (data) => {
-  let res: IQueryResult = await orderDetailAxios.fetch(data._id);
-  if (res.errcode == '0') {
-    form.value = res.data;
-    dialog.value = { title: '审核管理', show: true, type: '1' };
-  }
+//查看
+const toView = async (data) => {
+  router.push({ path: '/order/detail', query: { id: data._id } });
 };
 // 提交保存
 const toSave = async (data: any) => {

+ 39 - 5
src/views/system/buy/index.vue

@@ -9,7 +9,18 @@
           <cButton @toAdd="toAdd()"> </cButton>
         </el-col>
         <el-col :span="24" class="thr">
-          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @edit="toEdit" @del="toDel"> </cTable>
+          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @edit="toEdit" @del="toDel">
+            <template #leader="{ item, row }">
+              <template v-if="item.model === 'leader'">
+                <span size="small" type="primary">{{ getProps(row, item.model) }}</span>
+              </template>
+            </template>
+            <template #accounting="{ item, row }">
+              <template v-if="item.model === 'accounting'">
+                <span size="small" type="primary">{{ getProps(row, item.model) }}</span>
+              </template>
+            </template>
+          </cTable>
         </el-col>
       </el-col>
     </el-row>
@@ -28,12 +39,12 @@
             </template>
             <template #leader>
               <el-select v-model="form.leader" multiple placeholder="请选择审批领导" style="width: 100%">
-                <el-option v-for="item in ldList" :key="item._id" :label="item.name" :value="item._id" />
+                <el-option v-for="item in ldList" :key="item" :label="item.name" :value="item._id" />
               </el-select>
             </template>
             <template #accounting>
               <el-select v-model="form.accounting" multiple placeholder="请选择审批会计" style="width: 100%">
-                <el-option v-for="item in kjList" :key="item._id" :label="item.name" :value="item._id" />
+                <el-option v-for="item in kjList" :key="item" :label="item.name" :value="item._id" />
               </el-select>
             </template>
           </cForm>
@@ -71,8 +82,8 @@ let limit: number = proxy.$limit;
 let fields: Ref<any[]> = ref([
   { label: '所属街道', model: 'street', format: (i: any) => getDict(i, 'office') },
   { label: '所属社区', model: 'community', format: (i: any) => getDict(i, 'office') },
-  { label: '领导', model: 'leader' },
-  { label: '会计', model: 'accounting' },
+  { label: '领导', model: 'leader', custom: true },
+  { label: '会计', model: 'accounting', custom: true },
   { label: '是否使用', model: 'is_use', format: (i: any) => getDict(i, 'is_use') }
 ]);
 // 操作
@@ -157,6 +168,22 @@ const getDict = (value: any, model: any) => {
     }
   }
 };
+const getProps = (data: any, prop: any) => {
+  let list = [];
+  let res;
+  if (prop == 'leader') {
+    for (const val of data[prop]) {
+      res = ldList.value.find((i) => i._id == val);
+      if (res) list.push(res.name);
+    }
+  } else {
+    for (const val of data[prop]) {
+      res = kjList.value.find((i) => i._id == val);
+      if (res) list.push(res.name);
+    }
+  }
+  return list.toString();
+};
 // 新增
 const toAdd = () => {
   dialog.value = { title: '信息管理', show: true, type: '1' };
@@ -168,6 +195,7 @@ const toEdit = async (data: any) => {
   // 所属社区
   res = await officeAxios.query({ belong: data.street, type: '1', is_use: '0' });
   if (res.errcode == '0') communityList.value = res.data;
+  toChange(data.street);
   dialog.value = { title: '信息管理', show: true, type: '1' };
 };
 // 提交保存
@@ -206,6 +234,12 @@ const searchOther = async () => {
   // 所属街道
   res = await officeAxios.query({ type: '0', is_use: '0' });
   if (res.errcode == '0') streetList.value = res.data;
+  // 领导
+  res = await userAxios.query({ role: 'ld', status: '1' });
+  if (res.errcode == '0') ldList.value = res.data;
+  // 会计
+  res = await userAxios.query({ role: 'kj', status: '1' });
+  if (res.errcode == '0') kjList.value = res.data;
 };
 </script>
 <style scoped lang="scss">