[update] 画年度制修订计划(标准化发起)

This commit is contained in:
lideqin
2023-10-18 18:19:44 +08:00
parent 447fe783f9
commit 7bba0b1bb6
26 changed files with 2615 additions and 693 deletions
@@ -71,9 +71,13 @@
<!-- 节点3、工作组、所联络人填写企标-->
<contact-enter-standard-form v-if="currentNode === 3" ref="basicInfoFormRef"></contact-enter-standard-form>
<!-- 节点4、收集联络人主管级领导审批 只有表格,不能操作 -->
<only-table-form v-if="[4, 6, 7].includes(currentNode)" disabled ref="basicInfoFormRef"></only-table-form>
<only-table-form v-if="currentNode === 4" disabled ref="basicInfoFormRef"></only-table-form>
<!-- 节点5、各部所联络人汇总 只有表格,可操作 -->
<only-table-form v-if="currentNode === 5" ref="basicInfoFormRef"></only-table-form>
<!-- 节点6、联络人主管级上一级领导审批 表格不可操作,可以查看详情 -->
<only-table-form v-if="currentNode === 6" onlyCanLook ref="basicInfoFormRef"></only-table-form>
<!-- 节点7、标准化工程师归档 表格不可新增,可以编辑和查看详情 -->
<only-table-form v-if="currentNode === 7" disabled ref="basicInfoFormRef"></only-table-form>
<!-- 流程审批信息 -->
<div class="process-part-title">{{ $t('processApprovalInformation') }}</div>
@@ -151,7 +155,7 @@ import UserSelectModal from '@/components/selection/UserSelectModal'
const personData = [
{
id: 1,
nodeName: '主起草人发起',
nodeName: '标准化工程师发起',
nodeRoleName: '发起人',
canChoose: false
},
@@ -166,8 +170,7 @@ const personData = [
id: 3,
nodeName: '工作组/所联络人填写企标',
nodeRoleName: '工作组/所联络人',
canChoose: false,
chooseType: 'checkbox'
canChoose: false
},
{
id: 4,
@@ -262,6 +265,7 @@ export default {
],
validateTrigger: 'blur'
},
// 备注
remarks: {
rules: [
{
@@ -272,11 +276,10 @@ export default {
validateTrigger: 'blur'
}
},
currentNode: 1,
currentNode: 3,
approvalInfoForm: this.$form.createForm(this), // 审批信息表单
personnelInfoData: [], // 人员信息数据
url: {
importExcelUrl: '',
list: '' // 人员信息右侧表的分页查询接口
}
}
@@ -66,72 +66,18 @@
</a-form-model>
<!-- 是否下发联络人选了否,不显示完整表单,显示表格 -->
<div v-if="formInline.whetherToSendAContact === 2" class="change-base-info-wrapper">
<!-- 操作区域 -->
<div class="table-operator">
<!-- 新增 -->
<a-button icon="plus" type="primary" @click="handleAdd" :disabled="disabled">
{{ $t('newlyAdded') }}
</a-button>
<!-- 导入 -->
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button icon="upload" type="primary" ghost>{{ $t('import') }}</a-button>
</a-upload>
<!-- 批量删除 -->
<a-button icon="delete" type="primary" ghost @click="batchDel" :disabled="disabled">
{{ $t('batchDelete') }}
</a-button>
</div>
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="enterpriseStandardPlanId"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
<!-- 企标编号/企标名称 -->
<template v-slot:toDetail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a v-if="text" class="link-a" @click="handleGoDetail(record)">{{ text }}</a>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!-- 操作栏 -->
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.id, index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
</div>
</j-table>
</div>
<only-table-form ref="tableRef"></only-table-form>
</div>
<!-- 表格新增、编辑弹框 -->
<contact-enter-send-task-modal ref="contactEnterSendTaskModal" @ok="modelFormOk"></contact-enter-send-task-modal>
</div>
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
import store from '@/store'
import UserSelection from '@/components/selection/UserSelection'
import JTable from '@/components/jero/JTable'
import ContactEnterSendTaskModal from './ContactEnterSendTaskModal'
// 导入的加载提示
let importModalLoading
import OnlyTableForm from './OnlyTableForm'
export default {
name: 'ContactEnterSendTaskForm',
components: { ContactEnterSendTaskModal, UserSelection, JTable },
components: { OnlyTableForm, UserSelection },
props: {
disabled: {
type: Boolean,
@@ -144,19 +90,6 @@ export default {
default: 1
}
},
computed: {
tokenHeader () {
const head = { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) }
const tenantid = Vue.ls.get(TENANT_ID)
if (tenantid) {
head['tenant-id'] = tenantid
}
return head
},
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
data () {
return {
loading: false,
@@ -187,150 +120,6 @@ export default {
}
]
},
columns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 制修订类型
title: this.$t('enterpriseStandardLibrary.plan.revisionType'),
align: 'center',
width: 180,
dataIndex: 'applicationCategory_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 原企标编号
title: this.$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardNo',
scopedSlots: { customRender: 'toDetailOld' }
},
{ // 新企标编号
title: this.$t('enterpriseStandardLibrary.plan.newEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardNo',
scopedSlots: { customRender: 'toDetailNew' }
},
{ // 原企标名称
title: this.$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardName',
scopedSlots: { customRender: 'toDetailOld' }
},
{ // 新企标名称
title: this.$t('enterpriseStandardLibrary.plan.newEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardName',
scopedSlots: { customRender: 'toDetailNew' }
},
{ // 授权部门
title: this.$t('enterpriseStandardLibrary.plan.authDepartment'),
align: 'center',
width: 180,
dataIndex: 'authDeparts',
scopedSlots: { customRender: 'text' }
},
{ // 企业标准代号
title: this.$t('enterpriseStandardLibrary.plan.enterpriseStandardCode'),
align: 'center',
width: 180,
dataIndex: 'enStandardCode',
scopedSlots: { customRender: 'text' }
},
{ // 配合单位
title: this.$t('enterpriseStandardLibrary.plan.suitUnit'),
align: 'center',
width: 180,
dataIndex: 'cooperateDeparts',
scopedSlots: { customRender: 'text' }
},
{ // 主起草人
title: this.$t('enterpriseStandardLibrary.plan.principalDrafter'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUser',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位
title: this.$t('enterpriseStandardLibrary.plan.mainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnit',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位负责人
title: this.$t('enterpriseStandardLibrary.plan.headOfMainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnitResponsiblePerson',
scopedSlots: { customRender: 'text' }
},
{ // 隶属工作组
title: this.$t('workCenter.revisionPlanActivelyReport.affiliatedWorkingGroup'),
align: 'center',
width: 180,
dataIndex: 'affiliatedWorkingGroup',
scopedSlots: { customRender: 'text' }
},
{ // 标准推进人
title: this.$t('enterpriseStandardLibrary.plan.standardPusher'),
align: 'center',
width: 180,
dataIndex: 'standardPromoter',
scopedSlots: { customRender: 'text' }
},
{ // 草稿计划完成日期
title: this.$t('enterpriseStandardLibrary.plan.draftPlanFinishDate'),
align: 'center',
width: 180,
dataIndex: 'draftPlannedCompleteDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 征求意见稿计划完成日期
title: this.$t('enterpriseStandardLibrary.plan.exposureDraftPlanFinishDate'),
align: 'center',
width: 200,
dataIndex: 'solicitationDraftPlanCompleteDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 计划报批日期
title: this.$t('enterpriseStandardLibrary.plan.planSubmissionDate'),
align: 'center',
width: 180,
dataIndex: 'planApprovalDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 变更状态
title: this.$t('enterpriseStandardLibrary.plan.changeState'),
align: 'center',
width: 180,
dataIndex: 'changeStatus_dictText',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 200
}
],
dataSource: [],
selectedRowKeys: [],
selectionRows: [],
url: {
list: ''
},
modalType: '' // 是在新增还是在编辑,编辑的时候放正在编辑的下标
}
},
@@ -338,115 +127,6 @@ export default {
// 选择用户得到用户名
userSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_dictText'] = value
},
// 企标编号,企标名称跳转详情
handleGoDetail (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
standardNumber: record.standardNo
}
})
},
// 表格选中
onSelectChange (selectedRowKeys, selectionRows) {
this.selectedRowKeys = selectedRowKeys
this.selectionRows = selectionRows
},
// 新增或编辑完成
modelFormOk (value) {
console.log(value, this.modalType)
if (this.modalType === 'add') {
this.dataSource.push(value)
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') {
this.dataSource.splice(Number(this.modalType.split(',')[1]), 1, value)
}
},
// 新增
handleAdd () {
this.modalType = 'add'
this.$refs.contactEnterSendTaskModal.add()
},
// 导入
handleImportExcel (info) {
// 加一个大的提示
if (!this.loading) {
importModalLoading = this.$info({
title: '提示',
content: <span>正在导入,请稍候 <a-spin size="small" /></span>,
keyboard: false
})
}
this.loading = true
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList)
}
if (info.file.status === 'done') {
// 销毁这个提示
importModalLoading && importModalLoading.destroy()
this.loading = false
if (info.file.response.success) {
// this.$message.success(`${info.file.name} 文件上传成功`);
if (info.file.response.code === 201) {
const { message, result: { msg, fileUrl, fileName } } = info.file.response
const href = window._CONFIG.domianURL + fileUrl
this.$warning({
title: message,
content: (<div>
<span>{msg}</span><br />
<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
</div>
)
})
} else {
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
}
this.loadData()
} else {
this.$message.error(`${info.file.name} ${info.file.response.message}.`)
}
} else if (info.file.status === 'error') {
// 销毁这个提示
importModalLoading && importModalLoading.destroy()
this.loading = false
if (info.file.response.status === 500) {
const data = info.file.response
const token = Vue.ls.get(ACCESS_TOKEN)
if (token && data.message.includes('Token失效')) {
this.error({
title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录',
okText: '重新登录',
mask: false,
onOk: () => {
store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN)
window.location.reload()
})
}
})
}
} else {
this.$message.error(`文件上传失败: ${info.file.msg} `)
}
}
},
// 编辑
handleEdit (record, index) {
this.modalType = 'edit' + index
this.$refs.contactEnterSendTaskModal.edit(record)
},
// 删除
handleDelete (id, index) {
this.dataSource.splice(index, 1)
},
// 批量删除
batchDel () {
this.dataSource = this.dataSource.filter(item => !this.selectedRowKeys.includes(item.enterpriseStandardPlanId))
}
}
}
@@ -24,6 +24,7 @@
</div>
<a-form-model-item class="item-model" prop="applicationType">
<a-select v-model="formInline.applicationType"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.applicationType')">
<a-select-option :value="1">{{ $t('workCenter.enterpriseInitChangePlan.standardProjectEstablishment') }}</a-select-option>
</a-select>
@@ -40,6 +41,7 @@
<a-form-model-item class="item-model" prop="itemCategory">
<a-select v-model="formInline.itemCategory"
@change="itemCategoryChange"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.itemCategory')">
<a-select-option :value="1">{{ $t('workCenter.enterpriseInitChangePlan.formulate') }}</a-select-option>
<a-select-option :value="2">{{ $t('workCenter.enterpriseInitChangePlan.revise') }}</a-select-option>
@@ -76,6 +78,7 @@
<a-input class="box-input"
v-model="formInline.enterpriseStandardName"
:maxLength="50"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.enterpriseStandardName')" />
</a-form-model-item>
</div>
@@ -93,6 +96,7 @@
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.enterpriseStandardCode')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="enterprise_standard_code" />
</a-form-model-item>
</div>
@@ -110,6 +114,7 @@
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.enterpriseNameCode')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="enterprise_name_code" />
</a-form-model-item>
</div>
@@ -127,6 +132,7 @@
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardCategoryCode')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="standard_category_code" />
</a-form-model-item>
</div>
@@ -143,7 +149,7 @@
v-model="formInline.yearNumber"
:default-value="yearNumberDefaultValue"
date-format="YYYY"
@change="decadeCodeChange"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.yearNumber')" />
</a-form-model-item>
</div>
@@ -162,6 +168,7 @@
<standard-selection :source="StandardSource.ENTERPRISE.value"
:disabledSourceSearch="true"
type="radio"
:disabled="disabled"
v-model="formInline.enterpriseStandardNum"
@nameChange="nameChange"/>
</a-form-model-item>
@@ -209,6 +216,7 @@
<a-input class="box-input"
v-model="formInline.newEnterpriseStandardName"
:maxLength="50"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.newEnterpriseStandardName')" />
</a-form-model-item>
</div>
@@ -224,6 +232,7 @@
<a-input class="box-input"
v-model="formInline.standardEnglishName"
:maxLength="50"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enterpriseInitChangePlan.standardEnglishName')" />
</a-form-model-item>
</div>
@@ -244,6 +253,7 @@
tree-checkable
treeCheckStrictly
:label-in-value="false"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardSystem')" />
</a-form-model-item>
</div>
@@ -261,6 +271,7 @@
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardType')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="esp_standard_type" />
</a-form-model-item>
</div>
@@ -278,6 +289,7 @@
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.standardGradeClassification')"
:type="'select'"
:triggerChange="false"
:disabled="disabled"
dictCode="standard_grade_classify" />
</a-form-model-item>
</div>
@@ -311,6 +323,7 @@
<a-date-picker
v-model="formInline.draftPlanFinishDate"
:showTime="false"
:disabled="disabled"
value-format="YYYY-MM-DD">
</a-date-picker>
</a-form-model-item>
@@ -327,6 +340,7 @@
<a-date-picker
v-model="formInline.exposureDraftPlanFinishDate"
:showTime="false"
:disabled="disabled"
value-format="YYYY-MM-DD">
</a-date-picker>
</a-form-model-item>
@@ -343,6 +357,7 @@
<a-date-picker
v-model="formInline.planSubmissionDate"
:showTime="false"
:disabled="disabled"
value-format="YYYY-MM-DD">
</a-date-picker>
</a-form-model-item>
@@ -364,6 +379,7 @@
:getPopupContainer="triggerNode=> triggerNode.parentNode"
style="width: 100%"
:tree-data="workingGroupTreeList"
:disabled="disabled"
:placeholder="$t('pleaseSelect')"
/>
</a-form-model-item>
@@ -387,6 +403,7 @@
style="width: 100%"
:tree-data="partNameOptions"
:label-in-value="false"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enterpriseInitChangePlan.partName')" />
</a-form-model-item>
</div>
@@ -400,6 +417,7 @@
</div>
<a-form-model-item class="item-model" prop="authorizationDepart">
<j-select-depart v-model="formInline.authorizationDepart"
:disabled="disabled"
:backDepart="true" />
</a-form-model-item>
</div>
@@ -417,6 +435,7 @@
filedName="principalDrafter"
@nameChange="userSelectNameChange"
:nameStr="formInline.principalDrafter_dictText"
:disabled="disabled"
type="radio" />
</a-form-model-item>
</div>
@@ -430,6 +449,7 @@
</div>
<a-form-model-item class="item-model" prop="mainDraftUnit">
<j-select-depart v-model="formInline.mainDraftUnit"
:disabled="disabled"
:backDepart="true" />
</a-form-model-item>
</div>
@@ -447,6 +467,7 @@
filedName="headOfMainDraftingUnit"
@nameChange="userSelectNameChange"
:nameStr="formInline.headOfMainDraftingUnit_dictText"
:disabled="disabled"
type="radio" />
</a-form-model-item>
</div>
@@ -464,6 +485,7 @@
filedName="standardPusher"
@nameChange="userSelectNameChange"
:nameStr="formInline.standardPusher_dictText"
:disabled="disabled"
type="radio" />
</a-form-model-item>
</div>
@@ -475,6 +497,9 @@
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{ $t('submit') }}</a-button>
</div>
<!-- 文件上传弹框 -->
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false" :disabled="disabled"></upload-file>
</a-drawer>
</template>
@@ -483,21 +508,23 @@ import { StandardSource } from '@/enums/commonEnums'
import { getWorkGroupTreeList, getFormDictTreeList } from '@/api/api'
import UserSelection from '@/components/selection/UserSelection'
import StandardSelection from '@/components/selection/StandardSelection'
import UploadFile from '@/components/UploadFile'
import { getTreeList } from '@/api/enterpriseStandardLibraryApi'
import Vue from 'vue'
import { USER_INFO } from '@/store/mutation-types'
export default {
name: 'ContactEnterSendTaskModal',
components: { UserSelection, StandardSelection },
components: { UserSelection, StandardSelection, UploadFile },
data () {
return {
StandardSource,
workingGroupTreeList: [], // 隶属工作组下拉框数据
partNameOptions: [], // 零部件名称下拉框数据\
partNameOptions: [], // 零部件名称下拉框数据
standardSystemOptions: [], // 企标体系下拉框数据
visible: false,
confirmLoading: false,
disabled: false,
model: {},
formInline: {},
rules: {
@@ -695,13 +722,13 @@ export default {
const userInfo = Vue.ls.get(USER_INFO)
const formInline = {}
// 初始化主起草人信息
formInline.mainDraftingUser = userInfo.id
formInline.mainDraftingUser_dictText = userInfo.realname
formInline.principalDrafter = userInfo.id
formInline.principalDrafter_dictText = userInfo.realname
// 初始化主起草单位信息
formInline.mainDraftingUnit = userInfo.departIds
formInline.mainDraftUnit = userInfo.departIds
// 初始化起草单位负责人 todo: 看怎么获取当前登录人的上级
// 初始化年代号
formInline.decadeCode = new Date().getFullYear() + ''
formInline.yearNumber = new Date().getFullYear() + ''
this.edit(formInline)
},
edit (record) {
@@ -709,6 +736,12 @@ export default {
this.model = Object.assign({}, record)
this.formInline = Object.assign({}, record)
},
look (record) {
this.visible = true
this.model = Object.assign({}, record)
this.formInline = Object.assign({}, record)
this.disabled = true
},
// 获取零部件名称下拉框数据
initPartNameOptions () {
getFormDictTreeList({ dictId: '1696821512600637441' }).then(res => {
@@ -756,12 +789,29 @@ export default {
} else {
this.rules.enterpriseStandardName[0].required = false
}
this.formInline.decadeCode = new Date().getFullYear() + ''
this.formInline.yesrNumber = new Date().getFullYear() + ''
},
// 选择用户得到用户名
userSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_dictText'] = value
},
// 点击文件上传
clickButtonToUpload (fieldName) {
this.$refs.uploadFile.open(this.formInline[fieldName])
this.uploadName = fieldName
},
// 文件上传改变后的回调
uploadFileChange (data) {
const attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
},
// 取消
handleCancel () {
this.close()
@@ -24,71 +24,19 @@
</div>
</div>
</a-form-model>
<!-- 操作区域 -->
<div class="table-operator">
<!-- 新增 -->
<a-button icon="plus" type="primary" @click="handleAdd" :disabled="disabled">
{{ $t('newlyAdded') }}
</a-button>
<!-- 导入 -->
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button icon="upload" type="primary" ghost>{{ $t('import') }}</a-button>
</a-upload>
<!-- 批量删除 -->
<a-button icon="delete" type="primary" ghost @click="batchDel" :disabled="disabled">
{{ $t('batchDelete') }}
</a-button>
</div>
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="enterpriseStandardPlanId"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
<!-- 企标编号/企标名称 -->
<template v-slot:toDetail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a v-if="text" class="link-a" @click="handleGoDetail(record)">{{ text }}</a>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!-- 操作栏 -->
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.id, index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
</div>
</j-table>
</div>
<!-- 表格新增、编辑弹框 -->
<contact-enter-send-task-modal ref="contactEnterSendTaskModal" @ok="modelFormOk"></contact-enter-send-task-modal>
<!-- 表格 -->
<only-table-form ref="tableRef"></only-table-form>
</div>
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
import store from '@/store'
import UserSelection from '@/components/selection/UserSelection'
import JTable from '@/components/jero/JTable'
import ContactEnterSendTaskModal from './ContactEnterSendTaskModal'
// 导入的加载提示
let importModalLoading
import OnlyTableForm from './OnlyTableForm'
export default {
name: 'ContactEnterStandardForm',
components: { ContactEnterSendTaskModal, UserSelection, JTable },
components: { UserSelection, OnlyTableForm },
props: {
disabled: {
type: Boolean,
@@ -101,19 +49,6 @@ export default {
default: 1
}
},
computed: {
tokenHeader () {
const head = { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) }
const tenantid = Vue.ls.get(TENANT_ID)
if (tenantid) {
head['tenant-id'] = tenantid
}
return head
},
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
data () {
return {
loading: false,
@@ -128,150 +63,6 @@ export default {
}
]
},
columns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 制修订类型
title: this.$t('enterpriseStandardLibrary.plan.revisionType'),
align: 'center',
width: 180,
dataIndex: 'applicationCategory_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 原企标编号
title: this.$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardNo',
scopedSlots: { customRender: 'toDetailOld' }
},
{ // 新企标编号
title: this.$t('enterpriseStandardLibrary.plan.newEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardNo',
scopedSlots: { customRender: 'toDetailNew' }
},
{ // 原企标名称
title: this.$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardName',
scopedSlots: { customRender: 'toDetailOld' }
},
{ // 新企标名称
title: this.$t('enterpriseStandardLibrary.plan.newEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardName',
scopedSlots: { customRender: 'toDetailNew' }
},
{ // 授权部门
title: this.$t('enterpriseStandardLibrary.plan.authDepartment'),
align: 'center',
width: 180,
dataIndex: 'authDeparts',
scopedSlots: { customRender: 'text' }
},
{ // 企业标准代号
title: this.$t('enterpriseStandardLibrary.plan.enterpriseStandardCode'),
align: 'center',
width: 180,
dataIndex: 'enStandardCode',
scopedSlots: { customRender: 'text' }
},
{ // 配合单位
title: this.$t('enterpriseStandardLibrary.plan.suitUnit'),
align: 'center',
width: 180,
dataIndex: 'cooperateDeparts',
scopedSlots: { customRender: 'text' }
},
{ // 主起草人
title: this.$t('enterpriseStandardLibrary.plan.principalDrafter'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUser',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位
title: this.$t('enterpriseStandardLibrary.plan.mainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnit',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位负责人
title: this.$t('enterpriseStandardLibrary.plan.headOfMainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnitResponsiblePerson',
scopedSlots: { customRender: 'text' }
},
{ // 隶属工作组
title: this.$t('workCenter.revisionPlanActivelyReport.affiliatedWorkingGroup'),
align: 'center',
width: 180,
dataIndex: 'affiliatedWorkingGroup',
scopedSlots: { customRender: 'text' }
},
{ // 标准推进人
title: this.$t('enterpriseStandardLibrary.plan.standardPusher'),
align: 'center',
width: 180,
dataIndex: 'standardPromoter',
scopedSlots: { customRender: 'text' }
},
{ // 草稿计划完成日期
title: this.$t('enterpriseStandardLibrary.plan.draftPlanFinishDate'),
align: 'center',
width: 180,
dataIndex: 'draftPlannedCompleteDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 征求意见稿计划完成日期
title: this.$t('enterpriseStandardLibrary.plan.exposureDraftPlanFinishDate'),
align: 'center',
width: 200,
dataIndex: 'solicitationDraftPlanCompleteDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 计划报批日期
title: this.$t('enterpriseStandardLibrary.plan.planSubmissionDate'),
align: 'center',
width: 180,
dataIndex: 'planApprovalDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 变更状态
title: this.$t('enterpriseStandardLibrary.plan.changeState'),
align: 'center',
width: 180,
dataIndex: 'changeStatus_dictText',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 200
}
],
dataSource: [],
selectedRowKeys: [],
selectionRows: [],
url: {
list: ''
},
modalType: '' // 是在新增还是在编辑,编辑的时候放正在编辑的下标
}
},
@@ -279,115 +70,6 @@ export default {
// 选择用户得到用户名
userSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_dictText'] = value
},
// 企标编号,企标名称跳转详情
handleGoDetail (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
standardNumber: record.standardNo
}
})
},
// 表格选中
onSelectChange (selectedRowKeys, selectionRows) {
this.selectedRowKeys = selectedRowKeys
this.selectionRows = selectionRows
},
// 新增或编辑完成
modelFormOk (value) {
console.log(value, this.modalType)
if (this.modalType === 'add') {
this.dataSource.push(value)
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') {
this.dataSource.splice(Number(this.modalType.split(',')[1]), 1, value)
}
},
// 新增
handleAdd () {
this.modalType = 'add'
this.$refs.contactEnterSendTaskModal.add()
},
// 导入
handleImportExcel (info) {
// 加一个大的提示
if (!this.loading) {
importModalLoading = this.$info({
title: '提示',
content: <span>正在导入,请稍候 <a-spin size="small" /></span>,
keyboard: false
})
}
this.loading = true
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList)
}
if (info.file.status === 'done') {
// 销毁这个提示
importModalLoading && importModalLoading.destroy()
this.loading = false
if (info.file.response.success) {
// this.$message.success(`${info.file.name} 文件上传成功`);
if (info.file.response.code === 201) {
const { message, result: { msg, fileUrl, fileName } } = info.file.response
const href = window._CONFIG.domianURL + fileUrl
this.$warning({
title: message,
content: (<div>
<span>{msg}</span><br />
<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
</div>
)
})
} else {
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
}
this.loadData()
} else {
this.$message.error(`${info.file.name} ${info.file.response.message}.`)
}
} else if (info.file.status === 'error') {
// 销毁这个提示
importModalLoading && importModalLoading.destroy()
this.loading = false
if (info.file.response.status === 500) {
const data = info.file.response
const token = Vue.ls.get(ACCESS_TOKEN)
if (token && data.message.includes('Token失效')) {
this.error({
title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录',
okText: '重新登录',
mask: false,
onOk: () => {
store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN)
window.location.reload()
})
}
})
}
} else {
this.$message.error(`文件上传失败: ${info.file.msg} `)
}
}
},
// 编辑
handleEdit (record, index) {
this.modalType = 'edit' + index
this.$refs.contactEnterSendTaskModal.edit(record)
},
// 删除
handleDelete (id, index) {
this.dataSource.splice(index, 1)
},
// 批量删除
batchDel () {
this.dataSource = this.dataSource.filter(item => !this.selectedRowKeys.includes(item.enterpriseStandardPlanId))
}
}
}
@@ -10,6 +10,10 @@
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button icon="upload" type="primary" ghost>{{ $t('import') }}</a-button>
</a-upload>
<!-- 模板下载 -->
<a-button icon="download" type="primary" ghost @click="downTemplate($t('workCenter.revisionPlanActivelyReport.templateExport'))">
{{ $t('templateDownload') }}
</a-button>
<!-- 批量删除 -->
<a-button icon="delete" type="primary" ghost @click="batchDel" :disabled="disabled">
{{ $t('batchDelete') }}
@@ -39,9 +43,19 @@
<!-- 操作栏 -->
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.id, index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
<template v-if="!disabled">
<a @click="handleEdit(record, index)" class="table-ope-btn">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.id, index)" class="table-ope-btn">{{ $t('delete') }}</a>
</template>
<template v-else-if="onlyCanLook">
<a @click="handleLook(record, index)" class="table-ope-btn">{{ $t('lookDetail') }}</a>
</template>
<template v-else-if="editAndLook">
<a @click="handleEdit(record, index)" class="table-ope-btn">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleLook(record, index)" class="table-ope-btn">{{ $t('lookDetail') }}</a>
</template>
</div>
</j-table>
@@ -57,6 +71,7 @@ import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
import store from '@/store'
import JTable from '@/components/jero/JTable'
import ContactEnterSendTaskModal from './ContactEnterSendTaskModal'
import { downloadFile } from '@/api/manage'
// 导入的加载提示
let importModalLoading
@@ -69,6 +84,18 @@ export default {
type: Boolean,
required: false,
default: false
},
// 只能查看
onlyCanLook: {
type: Boolean,
required: false,
default: false
},
// 可以编辑和查看
editAndLook: {
type: Boolean,
required: false,
default: false
}
},
computed: {
@@ -234,7 +261,8 @@ export default {
selectedRowKeys: [],
selectionRows: [],
url: {
list: ''
list: '',
downTemplateUrl: ''
},
modalType: '' // 是在新增还是在编辑,编辑的时候放正在编辑的下标
}
@@ -254,6 +282,13 @@ export default {
this.selectedRowKeys = selectedRowKeys
this.selectionRows = selectionRows
},
// 下载导入模板
downTemplate (fileName) {
if (!fileName || typeof fileName !== 'string') {
fileName = '模板文件'
}
downloadFile(this.url.downTemplateUrl, fileName + '.xls')
},
// 新增或编辑完成
modelFormOk (value) {
console.log(value, this.modalType)
@@ -341,6 +376,10 @@ export default {
this.modalType = 'edit' + index
this.$refs.contactEnterSendTaskModal.edit(record)
},
// 查看
handleLook (record) {
this.$refs.contactEnterSendTaskModal.look(record)
},
// 删除
handleDelete (id, index) {
this.dataSource.splice(index, 1)