pref(cmdb-ui):batch upload for date type (#301)

This commit is contained in:
wang-liang0615 2023-12-12 14:53:12 +08:00 committed by GitHub
parent 65664ae8f9
commit b84d5d717e
3 changed files with 17 additions and 2 deletions

View File

@ -29,6 +29,7 @@
</template> </template>
<script> <script>
import moment from 'moment'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import CiTypeChoice from './modules/CiTypeChoice' import CiTypeChoice from './modules/CiTypeChoice'
import CiUploadTable from './modules/CiUploadTable' import CiUploadTable from './modules/CiUploadTable'
@ -73,7 +74,20 @@ export default {
const _ele = {} const _ele = {}
item.forEach((ele, j) => { item.forEach((ele, j) => {
if (ele !== undefined && ele !== null) { if (ele !== undefined && ele !== null) {
_ele[dataList[0][j]] = ele const _find = this.ciTypeAttrs.attributes.find(
(attr) => attr.alias === dataList[0][j] || attr.name === dataList[0][j]
)
if (_find?.value_type === '4') {
_ele[dataList[0][j]] = moment(Math.round((ele - 25569) * 86400 * 1000 - 28800000)).format('YYYY-MM-DD')
} else if (_find?.value_type === '3') {
_ele[dataList[0][j]] = moment(Math.round((ele - 25569) * 86400 * 1000 - 28800000)).format(
'YYYY-MM-DD HH:mm:ss'
)
} else if (_find?.value_type === '5') {
_ele[dataList[0][j]] = moment(Math.round(ele * 86400 * 1000 - 28800000)).format('HH:mm:ss')
} else {
_ele[dataList[0][j]] = ele
}
} }
}) })
return _ele return _ele

View File

@ -8,6 +8,7 @@
class="ops-stripe-table" class="ops-stripe-table"
:max-height="200" :max-height="200"
:data="dataSource" :data="dataSource"
resizable
> >
<vxe-column type="seq" width="40" /> <vxe-column type="seq" width="40" />
<vxe-column <vxe-column

View File

@ -372,7 +372,7 @@ export default {
}, },
async open(property, attrList) { async open(property, attrList) {
this.visible = true this.visible = true
this.getNoticeConfigAppBot() await this.getNoticeConfigAppBot()
this.attrList = attrList this.attrList = attrList
if (property.has_trigger) { if (property.has_trigger) {
this.triggerId = property.trigger.id this.triggerId = property.trigger.id