Commit 247c4bee authored by 李苏's avatar 李苏 💬

调整

parent 1f6943ac
...@@ -337,6 +337,20 @@ export const powerRoutes = [ ...@@ -337,6 +337,20 @@ export const powerRoutes = [
name: 'cneacpip', name: 'cneacpip',
path: "cneacpip", path: "cneacpip",
}, },
{
erpComponent: false,
component: 'ywxxgl/gshbmjby/index',
hidden: false,
meta: {
"title": "公司和部门级表扬",
"icon": "",
"noCache": false,
"link": null,
"mkid": '920050920',
},
name: 'gshbmjby',
path: "gshbmjby",
},
{ {
erpComponent: false, erpComponent: false,
component: 'ywxxgl/ywsjgl/index', component: 'ywxxgl/ywsjgl/index',
......
<template>
<DefaultDialog :app='app'>
<div slot="form" style="display: flex;height: 70vh;">
</div>
<div slot="reFooter" class="refooter" >
<span slot="footer" class="dialog-footer" >
<el-button @click="app.showDialog=false">取 消</el-button>
<el-button type="primary" @click="save()">保 存</el-button>
</span>
</div>
</DefaultDialog>
</template>
<script>
export default {
props: {
app: {
type: Object,
default: ()=>{
return {}
}
}
},
async mounted() {
},
data() {
return {
}
},
methods: {
}
}
</script>
<style scoped>
</style>
<!--
* @Description:生成基础baseEdit组件,屏蔽不必要细节
* @Author: lisu lisu@gavelinfo.com
* @Date: 2024-09-19 10:47:46
* @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2024-10-29 10:00:32
* @FilePath: /zghywpc-vue/src/views/ywxxgl/gshbmjby/edit.vue
-->
<template>
<!-- prop 穿透赋值 -->
<BaseEdit :attachments='attachments' v-bind="$attrs" @getForm='getForm' :config='editConfig'>
<template #form="ctx">
<el-tabs v-model="activeName">
<el-tab-pane label="完工附件" name="1">
<!-- 上传div-->
<div v-if="$attrs.type!='view'" style="border-bottom: 1px solid #eee;padding-bottom: 20px;">
<span style="line-height: 40px;font-size: 12px;font-weight: 700;color: #666;">附件上传</span>
<div class="upload padding-10">
<el-upload ref="upload" :headers='{
Gtoken
}' :data="{
groupid:'',
folder:'usbjx'
}" class="upload-demo" :action="`${baseurl}/attachment/upload/tmp`"
:on-success='success' :on-remove="handleRemove" :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
<div v-if="$attrs.type!='add'">
<span style="line-height: 40px;font-size: 12px;font-weight: 700;color: #666;">附件列表</span>
<div class="download padding-10">
<div class="fileList" style="font-weight: 800;background-color: #666;color: #eee;">
<div class="index">
序号
</div>
<div class="name">
文件名称
</div>
<div class="size">
文件大小
</div>
<div class="down">
</div>
<div class="del">
</div>
</div>
<div v-for="(item,index) in downList" :key="index" class="fileList">
<div class="index">
{{index+1}}
</div>
<div class="name">
{{item.name}}
</div>
<div class="size">
{{ sizeFormatter(item.size) }}
</div>
<div class="down">
<el-button @click="download(item)" size="mini" type="success">下载文件</el-button>
</div>
<div class="del">
<el-button @click="delitem(item.id,index)" size="mini" type="danger">删除文件</el-button>
</div>
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
</template>
</BaseEdit>
</template>
<script>
const baseurl = process.env.VUE_APP_BASE_API
const Gtoken = localStorage.getItem('Gtoken')
export default {
computed:{
attachments(){
let attachments=[]
this.attachmentList.forEach(item=>{
attachments.push({
id:item
})
})
this.downList.forEach(item=>{
attachments.push({
id:item.id
})
})
return attachments
}
},
data() {
return {
// attachments:[],
attachmentList:[],
Gtoken: Gtoken,
baseurl: baseurl,
fileList: [],
downList: [
],
/* 调整*/
activeName: '1',
editConfig: {
/* 生成form表单 */
editColItemList: [{
label: "年度",
prop: "year",
span: 12,
type: 'year'
},
{
label: "季度/大修轮次",
prop: "jddxlc",
span: 12,
type: 'input'
},
{
label: "项目",
prop: "xm",
span: 24,
type: 'input'
},
{
label: '主要负责人',
prop: 'zyfzrid',
span: 12,
type: 'AuxInput',
typeConfig: {
code: 'USER',
label: 'zyfzrName',
transform: {
value: 'id',
label: 'username'
}
}
},
{
label: '其他人',
prop: 'qtrid',
span: 24,
type: 'RelMulSelect',
value: [],
typeConfig: {
valueType: 'array',
src: "kzzx/user/query",
"match": {
"value": "id",
"label": "showLabel"
},
customLabel: (list) => {
list.forEach(item => {
item.showLabel = `${item.username}(${item.userid})`
})
}
},
required: false,
},
{
label: "签发日期",
prop: "qfrq",
span: 12,
type: 'datetime' // 因为fieldType为ftDateTime
},
{
label: "表扬类型",
prop: "bylx",
span: 12,
type: 'RelSelect',
value: "",
typeConfig: {
src: "ywxxgl/ugshbmjby/init/bylx",
match: {
value: "id",
label: "name"
}
} // 因为存在transform字段
},
{
label: "备注",
prop: "bz",
span: 24,
type: 'input' // 因为fieldType为ftString
}
],
/* 生成主从表,为空数组默认不展示 */
editTableTitle: [
// {
// title: "序号",
// field: "xh",
// width: 50,
// align: "center"
// },
// {
// title: "点检部位",
// field: "bw",
// width: 180,
// },
// {
// title: "点检项目",
// field: "project",
// width: 160
// },
// {
// title: "点检标准",
// field: "standard",
// width: 140
// },
],
/* 子表名,可选 同editTableTitle一起用*/
detailTable: ''
}
}
},
methods: {
getForm(form){
this.$post('ywxxgl/ugshbmjby/attachment/list', {
groupid: form.id,
}).then(res => {
res.data.records.forEach(item => {
this.downList.push(item)
})
})
},
sizeFormatter(bytes){
if (bytes === 0) return '0 B';
var k = 1000, // or 1024
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
},
download(item){
let url=`ywxxgl/ugshbmjby/attachment/download/${item.id}`
this.$cDownload(url, {},item.name)
},
delitem(id,index) {
this.$confirm('是否继续操作, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.downList.splice(index, 1)
})
},
handleRemove(file, fileList) {
let attachmentList = []
fileList.forEach(item => {
if (item.status == 'success') {
attachmentList.push(item.response.data.records.id)
}
})
this.attachmentList = attachmentList
},
success(res, file, fileList) {
if (res.success) {
this.$success('上传成功')
/* 成功后同步fileList数据到form表单*/
let attachmentList = []
fileList.forEach(item => {
if (item.status == 'success') {
attachmentList.push(item.response.data.records.id)
}
})
this.attachmentList = attachmentList
} else {
const delIndex = fileList.findIndex(item => item.uid === file.uid);
if (delIndex !== -1) {
fileList.splice(delIndex, 1);
this.$error(res.message || '未知错误');
}
}
},
/**
* @description:示例按钮
* @param {*} ctx操作edit实例内容
* @return {*}
* @author: lisu
*/
// demo(ctx){}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-tooltip {
display: none;
}
.download {
width: 100%;
border-top: 1px solid #eee;
}
.fileList {
display: flex;
line-height: 35px;
width: 100%;
border-bottom: 1px solid #eee;
text-align: center;
font-size: 12px;
.index {
width: 5%;
}
.name {
width: 35%;
}
.size {
width: 20%;
}
.down {
width: 20%;
}
.del {
width: 20%;
}
}
</style>
<!--
* @Description: 生成基础basePage组件,屏蔽不必要细节
* @Author: lisu lisu@gavelinfo.com
* @Date: 2024-09-19 10:55:27
* @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2024-10-29 10:03:12
* @FilePath: /zghywpc-vue/src/views/ywxxgl/gshbmjby/index.vue
-->
<template>
<BasePage class="min_full" :config="config">
<template #dialog="ctx">
<!-- 嵌入默认页面额外弹框的插槽 ctx.pagePage来操作默认页面 -->
</template>
<template #toolbar="ctx">
<!-- 嵌入默认页面工具栏的插槽 ctx.pagePage来操作默认页面 -->
<!-- <el-button @click="demo(ctx.basePage)" size='mini' type="primary">示例按钮</el-button> -->
</template>
</BasePage>
</template>
<script>
import Edit from './edit.vue'
export default {
name: 'gshbmjby',
data() {
return {
config: {
/* 基本配置*/
url: 'ywxxgl/ugshbmjby',
tableTitle: [{
label: "年度",
prop: "year",
width: 120
},
{
label: "季度/大修轮次",
prop: "jddxlc",
fieldType: "ftString",
width: 300
},
{
label: "项目",
prop: "xm",
fieldType: "ftString",
width: 192
},
{
label: "主要负责人",
prop: "zyfzrName",
fieldType: "ftString",
width: 192
},
{
label: "其他人",
prop: "qtrName",
fieldType: "ftString",
width: 192
},
{
label: "签发日期",
prop: "qfrq",
fieldType: "ftDateTime"
},
{
label: "表扬类型",
prop: "bylx",
width: 120,
"transform": {
"url": "ywxxgl/ugshbmjby/init/bylx",
"label": "name",
"value": "id"
}
},
{
label: "备注",
prop: "bz",
fieldType: "ftString",
width: 300
},
{
label: "维护人",
prop: "whr",
fieldType: "ftString"
},
{
label: "维护时间",
prop: "whsj",
fieldType: "ftDateTime"
},
{
label: "创建人",
prop: "cjr",
fieldType: "ftString"
},
{
label: "创建时间",
prop: "cjsj",
fieldType: "ftDateTime"
},
],
queryParams: [
[{
label: '表扬类别',
prop: 'bylx',
span: 6,
"type": "RelSelect",
"typeConfig": {
"src": "ywxxgl/ugshbmjby/init/bylx",
"match": {
"value": "id",
"label": "name"
}
}
},
{
label: '年度',
prop: 'year',
span: 6,
type: 'year',
value: ''
}
]
],
/* 默认启停用 */
}
}
},
methods: {
/**
* @description:示例按钮
* @param {*} ctx操作basePage实例内容
* @return {*}
* @author: lisu
*/
// demo(ctx){}
},
components: {
Edit
}
}
</script>
<style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment