123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- import Vue from "vue";
- import { base } from "@/configue/base";
- import { axios, serverName } from "@/configue/http";
- import { isImage, isTypeBySend, cloneObject, isNull } from "@/util/index.js";
- import { del, applyDetail, apply } from "@/configue/api";
- Vue.prototype.$base = base;
- Vue.prototype.$bus = new Vue();
- Vue.prototype.$http = axios;
- Vue.prototype.isImage = isImage;
- Vue.prototype.isTypeBySend = isTypeBySend;
- Vue.prototype.INPUTLENGTH = 20;
- Vue.prototype.PAGESIZES = [25, 50, 75, 100];
- Vue.prototype.UNITS = [{
- name:'第一层',
- id:'1'
- },{
- name:'第二层',
- id:'2'
- }]
- Vue.prototype.loading = {
- close() {},
- };
- Vue.prototype.loadOption = {
- lock: true,
- text: "上传中",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- };
- Vue.prototype.statusStr = {
- all: "全部",
- 0: "草稿中",
- 1: "待审核",
- 2: "审核不通过",
- 3: "审核通过",
- };
- Vue.prototype.statusArr = [
- {
- id: "all",
- name: "全部",
- },
- {
- id: 0,
- name: "草稿中",
- },
- {
- id: 1,
- name: "待审核",
- },
- {
- id: 2,
- name: "审核不通过",
- },
- {
- id: 3,
- name: "审核通过",
- },
- ];
- Vue.prototype.sysRole = [
- {
- name: "系统管理员",
- id: "sys_admin",
- },
- {
- name: "高级管理员",
- id: "sys_high",
- },
- {
- name: "普通用户",
- id: "sys_normal",
- },
- {
- name: "-",
- id: "sys_visitor",
- },
- ];
- Vue.prototype.collectType = {
- 1: "专题图库",
- 2: "视频文件",
- 3: "模型文件",
- };
- Vue.prototype.juese = {
- sys_admin: "系统管理员",
- sys_content: "内容管理员",
- sys_audit: "审核管理员"
- };
- Vue.prototype.sex = {
- 0: "男",
- 1: "女",
- };
- Vue.prototype.$serverName = serverName; // 挂载到Vue实例上面
- let g_political = [{
- val:'群众'
- },{
- val:'团员'
- },{
- val:'党员'
- },{
- val:'预备党员'
- }]
- let g_expert = [{
- val:'一级',
- id:1
- },{
- val:'二级',
- id:2
- },{
- val:'三级',
- id:3
- },{
- val:'院士',
- id:4
- },{
- val:'英模代表专家',
- id:6
- },{
- val:'其他',
- id:5
- }]
- import MainTop from "@/components/main-top";
- import search from "@/components/search";
- import accordion from "@/components/accordion";
- import status from "@/components/status";
- import vtable from "@/components/table";
- import dialog from "@/components/dialog";
- import editcon from "@/components/editcomponent/editcon";
- import editdialog from "@/components/editcomponent/editdialog";
- Vue.mixin({
- components: {
- MainTop,
- accordion,
- search,
- vtable,
- status,
- editcon,
- editdialog,
- vdialog: dialog,
- },
- data(){
- return {
- g_political,
- g_expert
- }
- },
- methods: {
- cloneObject,
- isNull,
- validate(cb) {
- let child = this.$refs.child;
- child.$refs[this.type].validate(async (valid) => {
- if (valid) {
- if (status == 2) {
- this.$confirm("请再次确认是否进行此操作?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- cb();
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "已取消",
- });
- });
- } else {
- cb();
- }
- }
- });
- },
- confirm(msg, res) {
- this.$confirm(msg, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- res();
- })
- .catch(() => {});
- },
- backList() {
- let name = this.$route.meta.index;
- let { type } = this.$route.params;
- this.$router.replace({
- name: name,
- params: {
- type,
- },
- });
- },
- goto(item) {
- let { type } = this.$route.params;
- console.log(type);
- this.$router.push({
- name: "edit-" + this.$route.name,
- params: {
- id: item.id,
- type: type,
- },
- });
- },
- del(data) {
- let { item, type } = data;
- this.confirm("删除后,信息将无法恢复,是否继续?", () => {
- del(
- type,
- {
- id: item.id,
- },
- () => {
- this.$alert("删除成功", "提示", {
- confirmButtonText: "确定",
- callback: () => {
- let tmp = this.getList ? "getList" : "backList";
- this[tmp]();
- },
- });
- }
- );
- });
- },
- audit(item) {
- let { type } = this.$route.params;
- this.$router.push({
- name: "edit-" + this.$route.name,
- params: { id: item.id, type: type },
- query: { isAudit: true },
- });
- },
- applyDetail(item, type) {
- applyDetail(type, { id: item.id }, (res) => {
- this.showApplyDetail = true;
- this.alDetail = res;
- });
- },
- submit(data,hadTwoParam=null) {
- let item = ''
- let type = ''
- if (hadTwoParam) {
- item = data
- type = hadTwoParam
- this.confirm("提交后,信息将保存并且进入审核,是否继续?", () => {
- this.save('submit',()=>{
- apply(type, { id: item.id }, () => {
- this.$alert("提交成功", "提示", {
- confirmButtonText: "确定",
- callback: () => {
- let tmp = this.getList ? "getList" : "backList";
- this[tmp]();
- },
- });
- });
- })
- });
- }
- else{
- item = data.item
- type = data.type
- this.confirm("提交后,信息将进入审核,是否继续?", () => {
- apply(type, { id: item.id }, () => {
- this.$alert("提交成功", "提示", {
- confirmButtonText: "确定",
- callback: () => {
- let tmp = this.getList ? "getList" : "backList";
- this[tmp]();
- },
- });
- });
- });
- }
-
- },
- determine() {
- let { isAudit } = this.$route.query;
- if (this.status === 1) {
- if (isAudit) {
- this.showAudit = true;
- return;
- }
- }
- this.backList();
- },
- getAuth(menu, key) {
- if (!menu) return;
- let auth = {};
- if (key == "场景" || key == '专家' || key=='沙盘' || key=='用户' || key=='角色' || key=='日志') {
- menu.children && menu.children.forEach((item) => {
- auth[item.name] = item.authority;
- });
- this.$store.commit("SetActiveSub", auth);
- } else {
- let temp =
- menu.children &&
- menu.children.find((item) => item.name.indexOf(key) > -1);
- console.log(menu, key);
- if (!temp) return;
- temp.children.forEach((item) => {
- auth[item.name] = item.authority;
- });
- this.$store.commit("SetActiveSub", auth);
- console.log(auth);
- }
- },
- },
- watch: {
- page: {
- deep: true,
- handler: function() {
- this.getList && this.getList();
- },
- }
- },
- });
|