作者 雷海东

工资基础信息劳动合同周期的修改

@@ -248,10 +248,9 @@ export default { @@ -248,10 +248,9 @@ export default {
248 title: '劳动合同周期', 248 title: '劳动合同周期',
249 align: 'center', 249 align: 'center',
250 dataIndex: 'contractTime', 250 dataIndex: 'contractTime',
251 - customRender: function (text) {  
252 - return !text ? '' : text.length > 10 ? text.substr(0, 10) : text  
253 - }, 251 +
254 }, 252 },
  253 +
255 { 254 {
256 title: '是否在职', 255 title: '是否在职',
257 align: 'center', 256 align: 'center',
@@ -282,8 +281,8 @@ export default { @@ -282,8 +281,8 @@ export default {
282 this.getSuperFieldList() 281 this.getSuperFieldList()
283 }, 282 },
284 computed: { 283 computed: {
285 - importExcelUrl: function(){  
286 - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; 284 + importExcelUrl: function () {
  285 + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
287 }, 286 },
288 }, 287 },
289 methods: { 288 methods: {
@@ -129,6 +129,7 @@ @@ -129,6 +129,7 @@
129 import { httpAction, getAction } from '@/api/manage' 129 import { httpAction, getAction } from '@/api/manage'
130 import { message } from 'ant-design-vue' 130 import { message } from 'ant-design-vue'
131 import { duplicateCheck2 } from '@/api/api' 131 import { duplicateCheck2 } from '@/api/api'
  132 +import moment from 'moment'
132 export default { 133 export default {
133 name: 'TblSalaryBaseForm', 134 name: 'TblSalaryBaseForm',
134 props: { 135 props: {
@@ -208,7 +209,6 @@ export default { @@ -208,7 +209,6 @@ export default {
208 return this.disabled 209 return this.disabled
209 }, 210 },
210 }, 211 },
211 -  
212 created() { 212 created() {
213 //备份model原始值 213 //备份model原始值
214 this.modelDefault = JSON.parse(JSON.stringify(this.model)) 214 this.modelDefault = JSON.parse(JSON.stringify(this.model))
@@ -219,11 +219,7 @@ export default { @@ -219,11 +219,7 @@ export default {
219 console.log('值:', dateString) 219 console.log('值:', dateString)
220 const startDate = dateString[0] 220 const startDate = dateString[0]
221 const endDate = dateString[1] 221 const endDate = dateString[1]
222 -  
223 - console.log('开始日期:', startDate)  
224 - this.model.contractTime = (startDate+"-"+endDate)  
225 - console.log(this.model.contractTime)  
226 - // this.model.contractTime=endDate 222 + this.model.contractTime = startDate + '~' + endDate
227 }, 223 },
228 validatePhone(rule, value, callback) { 224 validatePhone(rule, value, callback) {
229 // console.log(this.currentPhone) 225 // console.log(this.currentPhone)
@@ -260,6 +256,18 @@ export default { @@ -260,6 +256,18 @@ export default {
260 edit(record) { 256 edit(record) {
261 this.model = Object.assign({}, record) 257 this.model = Object.assign({}, record)
262 this.currentPhone = this.model.phone 258 this.currentPhone = this.model.phone
  259 + if (record.contractTime !== '' && record.contractTime !== null && record.contractTime!==undefined) {
  260 + // 解析 contractTime 字段,假设它是类似 "2024-06-27~2024-07-30" 的字符串
  261 + const [startDateStr, endDateStr] = record.contractTime.split('~')
  262 +
  263 + // 使用 Moment.js 将字符串转换为 Moment 对象
  264 + const startDate = moment(startDateStr, 'YYYY-MM-DD')
  265 + const endDate = moment(endDateStr, 'YYYY-MM-DD')
  266 +
  267 + // 将转换后的日期范围设置到 contractTime 中
  268 + this.contractTime = [startDate, endDate]
  269 + }
  270 +
263 this.visible = true 271 this.visible = true
264 }, 272 },
265 submitForm() { 273 submitForm() {