修改了工单展示问题,新增了工单查询问题

This commit is contained in:
chenze 2024-08-28 21:31:59 +08:00
parent 40b3f02f3a
commit d370007829
2 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,30 @@
import { axios } from '@/utils/request'
const api = {
repairFailureType: '/admin/repair/io'
}
export function exportTemplate () {
return axios({
url: api.repairFailureType + '/exportTemplate',
method: 'get',
responseType: 'blob'
})
}
export function exportRepair (parameter) {
return axios({
url: api.repairFailureType + '/exportRepair',
method: 'get',
params: parameter,
responseType: 'blob'
})
}
export function importData (data) {
return axios({
url: api.repairFailureType + '/importRepair',
method: 'post',
data: data
})
}

View File

@ -58,6 +58,10 @@
<span class="table-page-search-submitButtons">
<a-button type="primary" @click="getRepairList()">查询</a-button>
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
<a-button style="margin-left: 8px" type="primary" @click="exportRepair()">导出工单模板</a-button>
<a-button style="margin-left: 8px" type="primary" @click="exportRepairList()">导出工单模板</a-button>
<a-button style="margin-left: 8px" type="primary" @click="importDataVisible()">导入</a-button>
</span>
</a-col>
</a-row>
@ -91,7 +95,21 @@
</span>
</a-table>
<repair-modal ref="modal" @ok="handleOk" />
<a-modal v-model="visible" title="导入用户">
<div style="display: flex">
<a-upload
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
@change="customChange"
:customRequest="customRequest">
<a-button type="primary">导入用户数据</a-button>
</a-upload>
</div>
</a-modal>
</a-card>
</template>
<script>
@ -102,6 +120,9 @@ import RepairModal from './modules/RepairModal.vue'
import { checkPermission } from '@/utils/permissions'
import { getRepairDeviceList } from '@/api/admin/repair/repairDevice'
import { getRepairTypeList } from '@/api/admin/repair/repairDeviceType'
import { exportRepair, exportTemplate, importData } from '@/api/admin/repair/repairIo'
import storage from 'store'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: 'TableList',
@ -121,6 +142,10 @@ export default {
},
form: this.$form.createForm(this),
mdl: {},
visible: false,
headers: {
Authorization: 'Bearer ' + storage.get(ACCESS_TOKEN)
},
// /
advanced: false,
//
@ -241,15 +266,77 @@ export default {
this.selectType()
},
methods: {
customChange () {
},
customRequest (file) {
// file
// formData
// uploadFile
const formData = new FormData()
formData.append('file', file.file)
console.log(file)
importData(formData).then(res => {
if (res.code == 0) {
// ,
file.onSuccess(res, file.file)
file.status = 'done'
this.visible = false
this.$message.success('导入成功')
} else {
this.$message.error(res.msg)
file.onError()
file.status = 'error'
}
})
},
//
importDataVisible () {
this.visible = true
},
//
exportRepair () {
exportTemplate().then(res => {
this.exportExcel('工单模板', res)
})
},
//
exportRepairList () {
exportRepair({ startDate: '2024-08-01', endDate: '2024-08-30' }).then(res => {
this.exportExcel('工单导出', res)
})
},
exportExcel (filename, res) {
const link = document.createElement('a')
let blob = new Blob([res], { type: 'application/vnd.ms-excel;charset=UTF-8' })
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
let num = ''
for (let i = 0; i < 10; i++) {
num += Math.ceil(Math.random() * 10)
}
link.setAttribute('download', filename + '.xls')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
},
//
onChange (value, dateString) {
this.queryParam.startTime = dateString[0]
this.queryParam.endTime = dateString[1]
},
//
selectType () {
getRepairTypeList().then(res => {
this.typeList = res.rows
})
},
//
selectDevice (item) {
getRepairDeviceList({ 'typeId': item.key }).then(res => {
this.deviceList = res.rows
@ -262,6 +349,7 @@ export default {
this.deviceName = item.label
this.queryParam.deviceId = item.key
},
//
getRepairList () {
if (this.$route.query.repairUserId != null) {
oneWorkerList({ workerId: this.$route.query.repairUserId }).then(res => {