公众号编写

main
项洋 1 day ago
parent 6b2fd3520f
commit c7af02bee4

@ -32,7 +32,7 @@
<el-form-item label="系统类型:" prop="xtlx"> <el-form-item label="系统类型:" prop="xtlx">
<el-select v-model="formInline.xtlx" placeholder="请选择系统类型"> <el-select v-model="formInline.xtlx" placeholder="请选择系统类型">
<el-option <el-option
v-for="dict in dict.type.zc_xtlx" v-for="dict in zc_xtlx"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value"> :value="dict.value">
@ -65,7 +65,7 @@
<el-form-item label="系统状态:" prop="xtzt"> <el-form-item label="系统状态:" prop="xtzt">
<el-select v-model="formInline.xtzt" placeholder="请选择系统状态"> <el-select v-model="formInline.xtzt" placeholder="请选择系统状态">
<el-option <el-option
v-for="dict in dict.type.zc_xtzt" v-for="dict in zc_xtzt"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value"> :value="dict.value">
@ -75,8 +75,8 @@
</el-col> </el-col>
<el-col :span="9" style="text-align: right;padding-right: 35px;"> <el-col :span="9" style="text-align: right;padding-right: 35px;">
<el-form-item> <el-form-item>
<el-button size="mini" @click="resetQuery('queryFrom')"></el-button> <el-button size="mini" @click="resetQuery"></el-button>
<el-button size="mini" type="primary" @click="handleQuery('queryFrom')"></el-button> <el-button size="mini" type="primary" @click="handleQuery"></el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -90,7 +90,7 @@
<el-button <el-button
type="info" type="info"
plain plain
icon="el-icon-upload2" icon="Upload"
size="mini" size="mini"
@click="handleImport" @click="handleImport"
>导入</el-button> >导入</el-button>
@ -99,7 +99,7 @@
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="Download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
>导出</el-button> >导出</el-button>
@ -108,7 +108,7 @@
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="Plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增资产</el-button> >新增资产</el-button>
@ -120,51 +120,35 @@
<el-table-column type="index" width="60" label="序号" align="center"/> <el-table-column type="index" width="60" label="序号" align="center"/>
<el-table-column label="系统名称" key="xtmc" width="200px" prop="xtmc" align="center" /> <el-table-column label="系统名称" key="xtmc" width="200px" prop="xtmc" align="center" />
<el-table-column label="系统类型" key="xtlx" prop="xtlx" align="center"> <el-table-column label="系统类型" key="xtlx" prop="xtlx" align="center">
<template slot-scope="scope"> <template #default="scope">
<dict-tag :options="dict.type.zc_xtlx" :value="scope.row.xtlx"/> <dict-tag :options="zc_xtlx" :value="scope.row.xtlx"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单位名称" key="dwmc" prop="dwmc" align="center"> <el-table-column label="单位名称" key="dwmc" prop="dwmc" align="center" />
<!-- <template slot-scope="scope">
<dict-tag :options="dict.type.project_middle_type" :value="scope.row.projectMiddleType"/>
</template> -->
</el-table-column>
<el-table-column label="新增时间" key="createTime" prop="createTime" align="center" /> <el-table-column label="新增时间" key="createTime" prop="createTime" align="center" />
<el-table-column label="系统状态" key="status" prop="status" class-name="table-status" align="center"> <el-table-column label="系统状态" key="status" prop="status" class-name="table-status" align="center">
<template slot-scope="scope"> <template #default="scope">
<span v-if="scope.row.xtzt == 1" style="color: #16B771;"> <span v-if="scope.row.xtzt == 1" style="color: #16B771;"></span>
已安装 <span v-if="scope.row.xtzt == 2" style="color: #F58A0C;"></span>
</span> <span v-if="scope.row.xtzt == 3" style="color: #1485EF;">使</span>
<span v-if="scope.row.xtzt == 2" style="color: #F58A0C;"> <span v-if="scope.row.xtzt == 4" style="color: #29A07A;"></span>
测试中 <span v-if="scope.row.xtzt == 5" style="color: #F50C0C;"></span>
</span> <span v-if="scope.row.xtzt == 6" style="color: #F50C0C;"></span>
<span v-if="scope.row.xtzt == 3" style="color: #1485EF;">
使用中
</span>
<span v-if="scope.row.xtzt == 4" style="color: #29A07A;">
维护中
</span>
<span v-if="scope.row.xtzt == 5" style="color: #F50C0C;">
关停
</span>
<span v-if="scope.row.xtzt == 6" style="color: #F50C0C;">
备用
</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" prop="userId" class-name="table-operation" align="center"> <el-table-column label="操作" prop="userId" class-name="table-operation" align="center">
<template slot-scope="scope"> <template #default="scope">
<div style="display: flex;align-items: center;justify-content: center;"> <div style="display: flex;align-items: center;justify-content: center;">
<div style="display: flex;align-items: center;cursor: pointer;" @click="goInfo(scope.row,1)"> <div style="display: flex;align-items: center;cursor: pointer;" @click="goInfo(scope.row,1)">
<img src="@/assets/images/icon-ck@2x.png" alt="" style="width: 20px;margin-right: 5px;"> <el-icon><View /></el-icon>
<span class="look-info" style="color: #1485EF;margin-right: 15px;">查看</span> <span class="look-info" style="color: #1485EF;margin-right: 15px;">查看</span>
</div> </div>
<div style="display: flex;align-items: center;cursor: pointer;" @click="goInfo(scope.row,2)"> <div style="display: flex;align-items: center;cursor: pointer;" @click="goInfo(scope.row,2)">
<img src="@/assets/images/edit.png" alt="" style="width: 15px;margin-right: 5px;"> <el-icon><Edit /></el-icon>
<span class="look-info" style="color: #1485EF;margin-right: 15px;">编辑</span> <span class="look-info" style="color: #1485EF;margin-right: 15px;">编辑</span>
</div> </div>
<div style="display: flex;align-items: center;cursor: pointer;" @click="goInfo(scope.row,3)"> <div style="display: flex;align-items: center;cursor: pointer;" @click="goInfo(scope.row,3)">
<img src="@/assets/images/del.png" alt="" style="width: 20px;margin-right: 5px;"> <el-icon><Delete /></el-icon>
<span class="look-info" style="color: #F50C0C;margin-right: 15px;">删除</span> <span class="look-info" style="color: #F50C0C;margin-right: 15px;">删除</span>
</div> </div>
</div> </div>
@ -178,11 +162,16 @@
:page="formInline.current" :page="formInline.current"
:limit="formInline.size" :limit="formInline.size"
@pagination="getPagination" @pagination="getPagination"
:current-page.sync="formInline.current" v-model:current-page="formInline.current"
></my-pagination> />
</main> </main>
<!-- 资产导入对话框 --> <!-- 资产导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> <el-dialog
v-model="upload.open"
:title="upload.title"
width="400px"
append-to-body
>
<el-upload <el-upload
ref="upload" ref="upload"
:limit="1" :limit="1"
@ -195,230 +184,268 @@
:auto-upload="false" :auto-upload="false"
drag drag
> >
<i class="el-icon-upload"></i> <el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip"> <template #tip>
<!-- <div class="el-upload__tip" slot="tip"> <div class="el-upload__tip">
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据 <span>仅允许导入xlsxlsx格式文件</span>
</div> --> <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"></el-link>
<span>仅允许导入xlsxlsx格式文件</span> </div>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"></el-link> </template>
</div>
</el-upload> </el-upload>
<div slot="footer" class="dialog-footer"> <template #footer>
<el-button type="primary" @click="submitFileForm"> </el-button> <div class="dialog-footer">
<el-button @click="upload.open = false"> </el-button> <el-button type="primary" @click="submitFileForm"> </el-button>
</div> <el-button @click="upload.open = false"> </el-button>
</div>
</template>
</el-dialog> </el-dialog>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
<script> <script setup>
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance } from 'vue'
import { useRouter } from 'vue-router'
import myPagination from "@/views/components/Pagination/index.vue" import myPagination from "@/views/components/Pagination/index.vue"
// import myDialog from "@/views/components/myDialog/index.vue" import { getToken } from "@/utils/auth"
import { getToken } from "@/utils/auth"; import { assetUnit, deleteAssetInfo, schema } from "@/api/auditPagesApi/index"
import { assetUnit, deleteAssetInfo, schema } from "@/api/auditPagesApi/index"; import { useDict } from '@/utils/dict'
export default { import { ElMessage, ElMessageBox } from 'element-plus'
dicts: ['zc_xtzt','zc_xtlx'], import {
components:{myPagination}, View,
data() { Edit,
return { Delete,
// Upload,
deptOptions: undefined, Download,
defaultProps: { Plus,
children: "children", UploadFilled
label: "label" } from '@element-plus/icons-vue'
},
formInline:{ const { proxy } = getCurrentInstance()
xtmc:"", const router = useRouter()
xtlx:"",
time:[], //
startTime:"", const { zc_xtzt, zc_xtlx } = useDict('zc_xtzt', 'zc_xtlx')
endTime:"",
dwmc:"", //
xtzt:"", const deptOptions = ref()
current:1, const tree = ref(null)
size:20,
}, const defaultProps = {
total:0, children: "children",
tableData:[], label: "label"
loading:false, }
tabHeader: undefined,
// const formInline = reactive({
upload: { xtmc: "",
// xtlx: "",
open: false, time: [],
// startTime: "",
title: "web资产导入", endTime: "",
// dwmc: "",
isUploading: false, xtzt: "",
// current: 1,
updateSupport: 0, size: 20,
// })
headers: { Authorization: "Bearer " + getToken() },
// const total = ref(0)
// url: process.env.VUE_APP_BASE_API + "/tc/assetCurrent/import" const tableData = ref([])
url: location.origin + "/api/tc/assetCurrent/importData" const loading = ref(false)
}, const tabHeader = ref()
}
}, //
mounted(){ const upload = reactive({
if( Object.keys(this.$route.params).length != 0) { //
console.log(this.$route.params,"params"); open: false,
//
this.formInline = this.$route.params; title: "web资产导入",
}else{ //
this.formInline.current = 1 isUploading: false,
this.formInline.size = 20 //
updateSupport: 0,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: location.origin + "/api/tc/assetCurrent/importData"
})
/** 查询部门下拉树结构 */
const getDeptTree = () => {
schema({type:0}).then(response => {
deptOptions.value = response.data
})
}
//
const filterNode = (value, data) => {
if (!value) return true
return data.label.indexOf(value) !== -1
}
//
const handleNodeClick = (data) => {
formInline.deptId = data.id
handleQuery()
}
//
const getList = () => {
loading.value = true
assetUnit('get', formInline).then(res => {
loading.value = false
total.value = res.data.total
tableData.value = res.data.records
})
}
//
const resetQuery = () => {
proxy.$refs["queryForm"].resetFields()
formInline.deptId = undefined
tree.value.setCurrentKey(null)
handleQuery()
}
//
const handleQuery = () => {
formInline.current = 1
formInline.size = 20
if(formInline.time) {
formInline.startTime = formInline.time[0]
formInline.endTime = formInline.time[1]
}
formInline.time = []
getList()
}
//
const getPagination = (pages) => {
formInline.current = pages.page
formInline.size = pages.limit
getList()
}
//
const handleImport = () => {
upload.open = true
}
//
const handleExport = () => {
proxy.download('/tc/assetCurrent/export', {
...formInline
}, `web资产${new Date().getTime()}.xlsx`)
}
/** 下载模板操作 */
const importTemplate = () => {
proxy.download('/tc/assetCurrent/importTemplate', {},
`web资产导入模板${new Date().getTime()}.xlsx`)
}
//
const handleFileUploadProgress = () => {
upload.isUploading = true
}
//
const handleFileSuccess = (response, file, fileList) => {
upload.open = false
upload.isUploading = false
proxy.$refs.upload.clearFiles()
ElMessageBox.alert(
`<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>${response.msg}</div>`,
"导入结果",
{ dangerouslyUseHTMLString: true }
)
getList()
}
//
const submitFileForm = () => {
proxy.$refs.upload.submit()
}
//
const handleAdd = () => {
router.push({
name: 'AssetsAuth',
query: {
pageType: "add",
type: 0,
} }
this.getList(); })
this.getDeptTree(); }
this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce); //
}, const goInfo = (row, id) => {
destroyed() { if(id === 1) {
window.removeEventListener('resize', this.cancalDebounce); router.push({
}, name: 'AssetsAuth',
methods:{ query: {
/** 查询部门下拉树结构 */ pageType: "look",
getDeptTree() { type: 0,
schema({type:0}).then(response => { id: row.id,
this.deptOptions = response.data; queryData: formInline,
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
this.formInline.deptId = data.id;
this.handleQuery();
},
//
getList(){
this.loading = true;
console.log(this.formInline);
assetUnit('get',this.formInline).then(res=>{
this.loading = false;
this.total = res.data.total;
this.tableData = res.data.records;
})
},
//
resetQuery(){
this.resetForm("queryForm");
this.formInline.deptId = undefined;
this.$refs.tree.setCurrentKey(null);
this.handleQuery();
},
//
handleQuery(){
this.formInline.current = 1;
this.formInline.size = 20
if(this.formInline.time) {
this.formInline.startTime = this.formInline.time[0]
this.formInline.endTime = this.formInline.time[1]
} }
this.formInline.time = []; })
this.getList(); } else if(id === 2) {
}, router.push({
// name: 'AssetsAuth',
getPagination(pages){ query: {
this.formInline.current = pages.page; pageType: "change",
this.formInline.size = pages.limit; type: 0,
this.getList(); id: row.id,
}, queryData: formInline,
//
handleImport(){
this.upload.open = true;
},
//
handleExport(){
this.download('/tc/assetCurrent/export', {
...this.formInline
}, `web资产${new Date().getTime()}.xlsx`)
},
/** 下载模板操作 */
importTemplate() {
this.download('/tc/assetCurrent/importTemplate', {
}, `web资产导入模板${new Date().getTime()}.xlsx`)
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
},
//
handleAdd(){
this.$router.push({name: 'AssetsAuth',query: {
pageType: "add",
type:0,
}})
},
//
goInfo(row,id){
console.log(this.formInline,'this.formInline')
// if(id == 1) {
// this.$router.push({name: 'AssetsAuth',query: {
// pageType: "look",
// type:0,
// id:row.id,
// queryData:this.formInline,
// }})
// } else if(id == 2) {
// this.$router.push({name: 'AssetsAuth',query: {
// pageType: "change",
// type:0,
// id:row.id,
// queryData:this.formInline,
// }})
// } else if(id == 3) {
// const userIds = row.id;
// this.$modal.confirm('"' + userIds + '"').then(function() {
// return deleteAssetInfo(userIds);
// }).then(() => {
// this.getList();
// this.$modal.msgSuccess("");
// }).catch(() => {});
// }
},
//
edit(){
},
//
delInfo(){},
// table
tableRowClassName({row, rowIndex}){
if (rowIndex % 2 !== 0) {
return 'evenNumber-row';
} }
return ''; })
}, } else if(id === 3) {
// const userIds = row.id
cancalDebounce(){ ElMessageBox.confirm(
const element = document.getElementById('L-size-main'); // ID `是否确认删除用户编号为"${userIds}"的数据项?`
const header = document.getElementById('L-header'); // ID ).then(() => {
const pagination = document.getElementById('L-pagination'); // ID return deleteAssetInfo(userIds)
const elementHeight = element.offsetHeight; }).then(() => {
const headerHeight = header.offsetHeight; getList()
const paginationtHeight = pagination.offsetHeight; ElMessage.success("删除成功")
this.tabHeader = elementHeight - headerHeight - paginationtHeight - 110; }).catch(() => {})
} }
}, }
// table
const tableRowClassName = ({rowIndex}) => {
if (rowIndex % 2 !== 0) {
return 'evenNumber-row'
}
return ''
}
//
const cancalDebounce = () => {
const element = document.getElementById('L-size-main')
const header = document.getElementById('L-header')
const pagination = document.getElementById('L-pagination')
const elementHeight = element.offsetHeight
const headerHeight = header.offsetHeight
const paginationtHeight = pagination.offsetHeight
tabHeader.value = elementHeight - headerHeight - paginationtHeight - 110
} }
onMounted(() => {
if(Object.keys(router.currentRoute.value.params).length !== 0) {
Object.assign(formInline, router.currentRoute.value.params)
} else {
formInline.current = 1
formInline.size = 20
}
getList()
getDeptTree()
cancalDebounce()
window.addEventListener('resize', cancalDebounce)
})
onUnmounted(() => {
window.removeEventListener('resize', cancalDebounce)
})
</script> </script>

@ -9,7 +9,7 @@
<el-form <el-form
:model="ruleForm" :model="ruleForm"
:rules="rules" :rules="rules"
ref="ruleForm" ref="ruleFormRef"
label-width="170px" label-width="170px"
class="demo-ruleForm" class="demo-ruleForm"
label-position="right" label-position="right"
@ -35,7 +35,7 @@
placeholder="请选择平台类型" placeholder="请选择平台类型"
> >
<el-option <el-option
v-for="dict in dict.type.sys_ptlx_type" v-for="dict in sys_ptlx_type"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -106,7 +106,7 @@
@change="changeState" @change="changeState"
> >
<el-option <el-option
v-for="dict in dict.type.gzh_state" v-for="dict in gzh_state"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -132,7 +132,7 @@
placeholder="请选择公众号类型" placeholder="请选择公众号类型"
> >
<el-option <el-option
v-for="dict in dict.type.gzh_lx" v-for="dict in gzh_lx"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -149,7 +149,7 @@
placeholder="请选择认证状态" placeholder="请选择认证状态"
> >
<el-option <el-option
v-for="dict in dict.type.gzh_rzzt" v-for="dict in gzh_rzzt"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -178,7 +178,7 @@
placeholder="请选择认证类型" placeholder="请选择认证类型"
> >
<el-option <el-option
v-for="dict in dict.type.gzh_rzlx" v-for="dict in gzh_rzlx"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -193,7 +193,7 @@
placeholder="请选择所属行业" placeholder="请选择所属行业"
> >
<el-option <el-option
v-for="dict in dict.type.app_sshy" v-for="dict in app_sshy"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -210,7 +210,7 @@
placeholder="请选择重点行业" placeholder="请选择重点行业"
> >
<el-option <el-option
v-for="dict in dict.type.app_zdhy" v-for="dict in app_zdhy"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -225,7 +225,7 @@
placeholder="请选择行政区划" placeholder="请选择行政区划"
> >
<el-option <el-option
v-for="dict in dict.type.app_xzqh" v-for="dict in app_xzqh"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -377,7 +377,7 @@
placeholder="请选择菜单类型" placeholder="请选择菜单类型"
> >
<el-option <el-option
v-for="dict in dict.type.gzh_cdlx" v-for="dict in gzh_cdlx"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -470,7 +470,7 @@
placeholder="请选择账号状态" placeholder="请选择账号状态"
> >
<el-option <el-option
v-for="dict in dict.type.gzh_state" v-for="dict in gzh_state"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -508,7 +508,7 @@
placeholder="请选择重点行业" placeholder="请选择重点行业"
> >
<el-option <el-option
v-for="dict in dict.type.app_zdhy" v-for="dict in app_zdhy"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -523,7 +523,7 @@
placeholder="请选择所属行业" placeholder="请选择所属行业"
> >
<el-option <el-option
v-for="dict in dict.type.app_sshy" v-for="dict in app_sshy"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -629,171 +629,189 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script setup>
import { ref, reactive, onMounted, getCurrentInstance, nextTick } from "vue";
import { useRouter } from "vue-router";
import { import {
assetOfficialAccount, assetOfficialAccount,
assetOfficialAccountInfo, assetOfficialAccountInfo,
unitAllList, unitAllList,
} from "@/api/auditPagesApi/index"; } from "@/api/auditPagesApi/index";
import equalToPassword from "@/views/components/assetsType/mainx.js"; import equalToPassword from "@/views/components/assetsType/mainx.js";
import { useDict } from "@/utils/dict";
export default { const props = defineProps({
dicts: [ pageType: String,
"app_xzqh", id: [String, Number],
"app_sshy", queryData: Object,
"app_zdhy", });
"gzh_state",
"gzh_lx", const router = useRouter();
"gzh_rzzt", const { proxy } = getCurrentInstance();
"gzh_rzlx",
"gzh_cdlx", //
"sys_ptlx_type", const {
app_xzqh,
app_sshy,
app_zdhy,
gzh_state,
gzh_lx,
gzh_rzzt,
gzh_rzlx,
gzh_cdlx,
sys_ptlx_type,
} = useDict(
"app_xzqh",
"app_sshy",
"app_zdhy",
"gzh_state",
"gzh_lx",
"gzh_rzzt",
"gzh_rzlx",
"gzh_cdlx",
"sys_ptlx_type"
);
const ruleFormRef = ref(null);
const loading = ref(false);
const disabled = ref(false);
const ruleForm = reactive({
ptlx: "1",
cdList: [
{
cdmc: "",
cdlj: "",
cdlx: "",
},
], ],
data() { });
const changeSateTetx = (rule, value, callback) => {
if (this.ruleForm.gzhzt == 7 && !value) { //
callback(new Error("请填写")); const changeSateTetx = (rule, value, callback) => {
} else { if (ruleForm.gzhzt == 7 && !value) {
callback(); callback(new Error("请填写"));
} } else {
}; callback();
return { }
ruleForm: { };
ptlx: "1",
cdList: [ const rules = {
{ bfyy: [{ validator: changeSateTetx, trigger: "blur" }],
cdmc: "", ssdw: [
cdlj: "", { required: true, message: "所属单位不能为空", trigger: "blur" },
cdlx: "", { required: true, validator: equalToPassword, trigger: "change" },
}, ],
], };
},
rules: { //
bfyy: [{ validator: changeSateTetx, trigger: "blur" }], const changeState = (e) => {
ssdw: [ if (e != 7) {
{ required: true, message: "所属单位不能为空", trigger: "blur" }, ruleForm.bfyy = "";
{ required: true, validator: equalToPassword, trigger: "change" }, }
], };
// gzhmc:[
// { required: true, message: "", trigger: "blur" } //
// ], const removeDomain = (item, type) => {
}, const index = ruleForm[type].indexOf(item);
loading: false, if (index !== -1) {
disabled: false, ruleForm[type].splice(index, 1);
// disabledTwo:true, }
}; };
},
props: ["pageType", "id", "queryData"], //
mounted() { const addOtherConcat = (type) => {
if (this.pageType == "look") { ruleForm[type].push({
this.getInfo(this.id); cdmc: "",
this.disabled = true; cdlj: "",
this.$nextTick(() => { cdlx: "",
const inputElements = document.querySelectorAll(".el-input__inner"); });
const textareaInputElements = document.querySelectorAll( };
".el-textarea__inner"
); //
inputElements.forEach((input) => { const getInfo = (id) => {
input.placeholder = ""; assetOfficialAccountInfo(id).then((res) => {
}); Object.assign(ruleForm, res.data);
textareaInputElements.forEach((input) => { });
input.placeholder = ""; };
});
}); //
} else if (this.pageType == "change") { const ptlxChange = (item) => {
this.getInfo(this.id); Object.keys(ruleForm).forEach((key) => {
this.disabled = false; if (key == "cdList") {
// this.disabledTwo = false; ruleForm[key] = [];
return;
} }
}, if (key !== "ssdw" && key !== "ptlx") {
methods: { ruleForm[key] = "";
changeState(e) { }
console.log(e); });
if (e != 7) { };
this.ruleForm.bfyy = "";
} //
}, const querySearchAsync = (queryString, cb) => {
removeDomain(item, type) { let results = [];
var index = this.ruleForm[type].indexOf(item); unitAllList({ nickName: queryString }).then((res) => {
if (index !== -1) { res.data.forEach((item) => {
this.ruleForm[type].splice(index, 1); results.push({
} value: item.nickName,
}, id: item.id,
//
addOtherConcat(type) {
this.ruleForm[type].push({
cdmc: "",
cdlj: "",
cdlx: "",
// key: Date.now()
});
},
getInfo(id) {
assetOfficialAccountInfo(id).then((res) => {
this.ruleForm = res.data;
}); });
}, });
// cb(results);
ptlxChange(item) { });
Object.keys(this.ruleForm).forEach((key) => { };
if(key =="cdList"){
this.ruleForm[key] = [];
return
}
if (key !== "ssdw" && key !== "ptlx" ) {
this.ruleForm[key] = "";
}
//
const newAssets = () => {
if (!ruleFormRef.value) return;
}); ruleFormRef.value.validate((valid) => {
}, if (valid) {
// loading.value = true;
querySearchAsync(queryString, cb) { if (props.pageType == "change") {
let results = []; assetOfficialAccount("put", ruleForm).then((res) => {
unitAllList({ nickName: queryString }).then((res) => { loading.value = false;
res.data.forEach((item) => { proxy.$modal.msgSuccess("修改成功");
results.push({ router.push({
value: item.nickName, name: "OfficialAccount",
id: item.id, params: props.queryData,
}); });
}); });
}); } else {
cb(results); assetOfficialAccount("post", ruleForm).then((res) => {
}, loading.value = false;
// proxy.$modal.msgSuccess("新增成功");
newAssets() { router.go(-1);
console.log(this.ruleForm); });
}
}
});
};
this.$refs["ruleForm"].validate((valid) => { const sendBack = () => {
if (valid) { router.push({ name: "OfficialAccount", params: props.queryData });
this.loading = true; };
if (this.pageType == "change") {
assetOfficialAccount("put", this.ruleForm).then((res) => {
// console.log(res,"res");
this.loading = false;
this.$modal.msgSuccess("修改成功");
// this.$router.go(-1);
this.$router.push({
name: "OfficialAccount",
params: this.queryData,
});
});
} else {
assetOfficialAccount("post", this.ruleForm).then((res) => { onMounted(() => {
// console.log(res,"res"); if (props.pageType == "look") {
this.loading = false; getInfo(props.id);
this.$modal.msgSuccess("新增成功"); disabled.value = true;
this.$router.go(-1); nextTick(() => {
}); const inputElements = document.querySelectorAll(".el-input__inner");
} const textareaInputElements = document.querySelectorAll(
} ".el-textarea__inner"
);
inputElements.forEach((input) => {
input.placeholder = "";
}); });
}, textareaInputElements.forEach((input) => {
sendBack() { input.placeholder = "";
// this.$router.go(-1); });
this.$router.push({ name: "OfficialAccount", params: this.queryData }); });
}, } else if (props.pageType == "change") {
}, getInfo(props.id);
}; disabled.value = false;
}
});
</script> </script>

Loading…
Cancel
Save