zs 3 anos atrás
pai
commit
eb85ebd826

+ 3 - 0
src/plugins/components.js

@@ -2,11 +2,14 @@ import Vue from 'vue';
 import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import dataForm from '@common/src/components/frame/form.vue';
 import eUpload from '@common/src/components/frame/e-upload.vue';
+import sUpload from '@common/src/components/frame/s-upload.vue';
+
 const Plugin = (vue) => {
   vue.prototype.$dev_mode = process.env.NODE_ENV === 'development';
   vue.component('data-table', dataTable);
   vue.component('data-form', dataForm);
   vue.component('eUpload', eUpload);
+  vue.component('sUpload', sUpload);
 };
 
 Vue.use(Plugin);

+ 16 - 6
src/router/index.js

@@ -32,14 +32,24 @@ const web = [
         component: () => import('../views/adminCenter/homeIndex/index.vue'),
       },
       {
-        path: '/adminCenter/test',
-        meta: { title: '测试菜单' },
-        component: () => import('../views/adminCenter/test/index.vue'),
+        path: '/involved',
+        meta: { title: '涉案人员' },
+        component: () => import('../views/involved/index.vue'),
       },
       {
-        path: '/adminCenter/test/detail',
-        meta: { title: '测试菜单-信息管理' },
-        component: () => import('../views/adminCenter/test/detail.vue'),
+        path: '/cigarette',
+        meta: { title: '涉案卷烟' },
+        component: () => import('../views/cigarette/index.vue'),
+      },
+      {
+        path: '/cigarette/detail',
+        meta: { title: '涉案卷烟-信息管理' },
+        component: () => import('../views/cigarette/detail.vue'),
+      },
+      {
+        path: '/involved/detail',
+        meta: { title: '涉案人员-信息管理' },
+        component: () => import('../views/involved/detail.vue'),
       },
     ],
   },

+ 5 - 2
src/store/index.js

@@ -2,7 +2,10 @@ import Vue from 'vue';
 import Vuex from 'vuex';
 import * as ustate from '@common/src/store/user/state';
 import * as umutations from '@common/src/store/user/mutations';
-import test from '@common/src/store/test';
+// 涉案人员
+import involved from '@common/src/store/involved';
+// 涉案卷烟
+import cigarette from '@common/src/store/cigarette';
 
 Vue.use(Vuex);
 
@@ -10,5 +13,5 @@ export default new Vuex.Store({
   state: { ...ustate },
   mutations: { ...umutations },
   actions: {},
-  modules: { test },
+  modules: { cigarette, involved },
 });

+ 1 - 1
src/util/print.js

@@ -160,4 +160,4 @@ MyPlugin.install = function (Vue, options) {
   // 4. 添加实例方法
   Vue.prototype.$print = Print
 }
-export default MyPlugin
+export default MyPlugin

+ 101 - 0
src/views/cigarette/detail.vue

@@ -0,0 +1,101 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight">
+        <el-col :span="24" class="one">
+          <data-form :fields="fields" :data="form" @save="toSave" returns="/cigarette">
+            <template #custom="{ item }">
+              <template v-if="item.model == 'file'">
+                <s-upload :limit="6" :data="form.file" type="file" :url="uri" @upload="uplSuc" @delete="uplDel"></s-upload>
+              </template>
+            </template>
+          </data-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('cigarette');
+export default {
+  name: 'detail',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      form: { file: [] },
+      fields: [
+        { label: '名称', model: 'name' },
+        { label: '外国卷烟翻译', model: 'englishname' },
+        { label: '数量', model: 'num' },
+        { label: '单价', model: 'price' },
+        { label: '品牌', model: 'brand' },
+        { label: '产地', model: 'origin' },
+        { label: '物品性质', model: 'nature' },
+        { label: '品牌规格/型号', model: 'model' },
+        { label: '涉案案件编号', model: 'casenum' },
+        { label: '卷烟照片', model: 'file', custom: true },
+      ],
+      uri: '/files/tobaccocms/upload',
+    };
+  },
+  created() {
+    if (this.id) this.search();
+  },
+  methods: {
+    ...mapActions(['fetch', 'create', 'update']),
+    async search() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    // 提交
+    async toSave({ data }) {
+      let dup = _.cloneDeep(data);
+      if (data.id) {
+        let res = await this.update(dup);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `维护信息成功` });
+          this.$router.push('/cigarette');
+        }
+      } else {
+        let res = await this.create(dup);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `创建信息成功` });
+          this.$router.push('/cigarette');
+        }
+      }
+    },
+    // 上传图片
+    // 上传图片
+    uplSuc({ type, data }) {
+      this.form[type].push({ name: data.name, url: data.uri });
+    },
+    uplDel(data) {
+      let index = this.form.file.findIndex((i) => i.url == data.file.url);
+      this.form.file.splice(index, 1);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 136 - 0
src/views/cigarette/index.vue

@@ -0,0 +1,136 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight">
+        <el-col :span="24" class="one">
+          <el-col :span="24" class="one_1"><span>涉案卷烟</span><span>(需要提供表格填写内容)</span></el-col>
+          <el-col :span="24" class="one_2"><span></span></el-col>
+        </el-col>
+        <el-col :span="24" class="two">
+          <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit" @delete="toDel">
+            <template #selfbtn>
+              <el-button type="primary" size="mini" @click="toAdd">添加</el-button>
+            </template>
+          </data-table>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('cigarette');
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      list: [],
+      total: 0,
+      opera: [
+        { label: '修改', method: 'edit' },
+        { label: '删除', method: 'delete', type: 'danger' },
+      ],
+      fields: [
+        { label: '名称', prop: 'name', filter: 'input' },
+        { label: '外国卷烟翻译', prop: 'englishname' },
+        { label: '数量', prop: 'num' },
+        { label: '单价', prop: 'price' },
+        { label: '品牌', prop: 'brand' },
+        { label: '产地', prop: 'origin', filter: 'input' },
+        { label: '物品性质', prop: 'nature' },
+        { label: '品牌规格/型号', prop: 'model' },
+        { label: '涉案案件编号', prop: 'casenum', filter: 'input' },
+        // { label: '卷烟照片', prop: 'file' },
+      ],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...mapActions(['query', 'delete']),
+    // 查询
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const condition = _.cloneDeep(this.searchForm);
+      let res = await this.query({ skip, limit, ...condition, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 添加
+    toAdd() {
+      this.$router.push({ path: '/cigarette/detail' });
+    },
+    // 修改
+    toEdit({ data }) {
+      this.$router.push({ path: '/cigarette/detail', query: { id: data._id } });
+    },
+    // 删除
+    async toDel({ data }) {
+      let res = await this.delete(data._id);
+      if (this.$checkRes(res)) {
+        this.$message({ type: `success`, message: `刪除信息成功` });
+        this.search();
+      }
+    },
+    // 关闭
+    toClose() {
+      this.form = {};
+      this.searchForm = {};
+      this.dialog = { title: '信息管理', show: false, type: '1' };
+      this.search();
+    },
+    // 多选
+    handleSelect(data) {
+      this.$set(this, `selected`, data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .one {
+    margin: 0 0 10px 0;
+    .one_1 {
+      span:nth-child(1) {
+        font-size: 20px;
+        font-weight: 700;
+        margin-right: 10px;
+      }
+      span:nth-child(2) {
+        font-size: 14px;
+        color: #979797;
+      }
+    }
+    .one_2 {
+      span:nth-child(1) {
+        display: inline-block;
+        color: #8baae7;
+        font-size: 14px;
+        margin-top: 10px;
+      }
+    }
+  }
+  .two {
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 117 - 0
src/views/involved/detail.vue

@@ -0,0 +1,117 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight">
+        <el-col :span="24" class="one">
+          <data-form :fields="fields" :data="form" @save="toSave" returns="/involved">
+            <template #custom="{ item }">
+              <template v-if="item.model == 'card'">
+                <el-input v-model="form.card" placeholder="请输入身份证号" @blur="toBlur"></el-input>
+              </template>
+            </template>
+          </data-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('involved');
+export default {
+  name: 'detail',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      form: {},
+      fields: [
+        { label: '姓名', model: 'name' },
+        { label: '曾用名', model: 'beforename' },
+        { label: '身份证号', model: 'card', custom: true },
+        { label: '性别', model: 'gender' },
+        { label: '年龄', model: 'age' },
+        { label: '籍贯', model: 'nativeaddr' },
+        { label: '住址', model: 'address' },
+        { label: '工作单位', model: 'unit' },
+        { label: '职业', model: 'work' },
+        { label: '社会关系', model: 'sociology' },
+        { label: '涉案信息', model: 'involvedinfo' },
+      ],
+      genderList: [
+        { label: '男', value: '男' },
+        { label: '女', value: '女' },
+      ],
+    };
+  },
+  created() {
+    if (this.id) this.search();
+  },
+  methods: {
+    ...mapActions(['fetch', 'create', 'update']),
+    async search() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    // 提交
+    async toSave({ data }) {
+      let dup = _.cloneDeep(data);
+      if (data.id) {
+        let res = await this.update(dup);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `维护信息成功` });
+          this.$router.push('/involved');
+        }
+      } else {
+        let res = await this.create(dup);
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `创建信息成功` });
+          this.$router.push('/involved');
+        }
+      }
+    },
+    // 输入身份证号,解析身份证信息
+    // 获取身份证信息
+    toBlur(event) {
+      let value = _.get(event.target, 'value');
+      if (value) {
+        // 获取性别
+        if (parseInt(value.substr(16, 1)) % 2 == 1) this.$set(this.form, `gender`, '男');
+        else this.$set(this.form, `gender`, '女');
+        // // 获取出生日期
+        // let birthday = '';
+        // if (value != null && value != '') {
+        //   if (value.length == 15) {
+        //     birthday = '19' + value.slice(6, 12);
+        //   } else if (value.length == 18) {
+        //     birthday = value.slice(6, 14);
+        //   }
+        //   birthday = birthday.replace(/(.{4})(.{2})/, '$1-$2-');
+        // }
+        // this.$set(this.form, `birth`, birthday);
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 138 - 0
src/views/involved/index.vue

@@ -0,0 +1,138 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight">
+        <el-col :span="24" class="one">
+          <el-col :span="24" class="one_1"><span>涉案人员</span><span>(需要提供表格填写内容)</span></el-col>
+          <el-col :span="24" class="one_2"><span></span></el-col>
+        </el-col>
+        <el-col :span="24" class="two">
+          <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit" @delete="toDel">
+            <template #selfbtn>
+              <el-button type="primary" size="mini" @click="toAdd">添加</el-button>
+            </template>
+          </data-table>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('involved');
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      list: [],
+      total: 0,
+      opera: [
+        { label: '修改', method: 'edit' },
+        { label: '删除', method: 'delete', type: 'danger' },
+      ],
+      fields: [
+        { label: '姓名', prop: 'name', filter: 'input' },
+        { label: '曾用名', prop: 'beforename' },
+        { label: '身份证号', prop: 'card', filter: 'input' },
+        { label: '性别', prop: 'gender' },
+        { label: '年龄', prop: 'age' },
+        { label: '籍贯', prop: 'nativeaddr' },
+        { label: '住址', prop: 'address' },
+        { label: '工作单位', prop: 'unit' },
+        { label: '职业', prop: 'work', filter: 'input' },
+        { label: '社会关系', prop: 'sociology' },
+        { label: '涉案信息', prop: 'involvedinfo' },
+        { label: '备注', prop: 'remark' },
+      ],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...mapActions(['query', 'delete']),
+    // 查询
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const condition = _.cloneDeep(this.searchForm);
+      let res = await this.query({ skip, limit, ...condition, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 添加
+    toAdd() {
+      this.$router.push({ path: '/involved/detail' });
+    },
+    // 修改
+    toEdit({ data }) {
+      this.$router.push({ path: '/involved/detail', query: { id: data._id } });
+    },
+    // 删除
+    async toDel({ data }) {
+      let res = await this.delete(data._id);
+      if (this.$checkRes(res)) {
+        this.$message({ type: `success`, message: `刪除信息成功` });
+        this.search();
+      }
+    },
+    // 关闭
+    toClose() {
+      this.form = {};
+      this.searchForm = {};
+      this.dialog = { title: '信息管理', show: false, type: '1' };
+      this.search();
+    },
+    // 多选
+    handleSelect(data) {
+      this.$set(this, `selected`, data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .one {
+    margin: 0 0 10px 0;
+    .one_1 {
+      span:nth-child(1) {
+        font-size: 20px;
+        font-weight: 700;
+        margin-right: 10px;
+      }
+      span:nth-child(2) {
+        font-size: 14px;
+        color: #979797;
+      }
+    }
+    .one_2 {
+      span:nth-child(1) {
+        display: inline-block;
+        color: #8baae7;
+        font-size: 14px;
+        margin-top: 10px;
+      }
+    }
+  }
+  .two {
+    margin: 0 0 10px 0;
+  }
+}
+</style>