Browse Source

2023-11-13 plm提交

master
杨奉源 2 years ago
parent
commit
9ed7c1db67
  1. 29
      src/api/part/umInformation.js
  2. 5
      src/views/modules/common/Chooselist.vue
  3. 55
      src/views/modules/part/partInformation.vue
  4. 514
      src/views/modules/part/umInformation.vue

29
src/api/part/umInformation.js

@ -0,0 +1,29 @@
import { createAPI } from "@/utils/httpRequest.js";
/**
* 单位信息列表查询
* @param data
* @returns {*}
*/
export const umInformationSearch = data => createAPI(`/plm/umInformation/umInformationSearch`,'post',data)
/**
* 单位信息新增
* @param data
* @returns {*}
*/
export const umInformationSave = data => createAPI(`/plm/umInformation/umInformationSave`,'post',data)
/**
* 单位信息编辑
* @param data
* @returns {*}
*/
export const umInformationEdit = data => createAPI(`/plm/umInformation/umInformationEdit`,'post',data)
/**
* 单位信息删除
* @param data
* @returns {*}
*/
export const umInformationDelete = data => createAPI(`/plm/umInformation/umInformationDelete`,'post',data)

5
src/views/modules/common/Chooselist.vue

@ -111,13 +111,14 @@ export default {
getChooselist({"tagNo": tagNo}).then(({data}) => {
this.columnList = []
this.baseListData = data.data
let start = data.data.sqlcode.indexOf("Select")
let end = data.data.sqlcode.indexOf("from")
let start = data.data.sqlcode.toUpperCase().indexOf("Select".toUpperCase())
let end = data.data.sqlcode.toUpperCase().indexOf("from".toUpperCase())
let length = end - start
let columns = data.data.sqlcode.trim().substring(start + 6, length).trim()
let props = columns.split(",")
props.forEach((item, index) => {
let name = '信息列'
//debugger
switch (index) {
case 0:
name = this.baseListData.caption1

55
src/views/modules/part/partInformation.vue

@ -130,7 +130,7 @@
<el-form-item label="规格型号">
<el-input v-model="modalData.spec" style="width: 221px"></el-input>
</el-form-item>
<el-form-item prop="umId" :rules="rules.umId">
<el-form-item>
<span slot="label" @click="getBaseList(107,1)"><a herf="#">计量单位</a></span>
<el-input v-model="modalData.umName" style="width: 221px"></el-input>
</el-form-item>
@ -166,7 +166,7 @@
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
<el-form-item prop="codeDesc" :rules="rules.codeDesc">
<el-form-item>
<span slot="label" @click="getBaseList(20,1)"><a herf="#">属性模板</a></span>
<el-input v-model="modalData.codeDesc" style="width: 221px"></el-input>
</el-form-item>
@ -736,55 +736,7 @@
],
// ======== ========
rules: {
customerDesc: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
trackerName: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
projectName: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
quoterName: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
partName: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
priorityLevel: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
requiredCompletionDate: [
{
required: true,
message: ' ',
trigger: 'change'
}
]
},
// ======== ========
partSelections: [],
@ -1209,7 +1161,6 @@
* @param val
*/
getBaseData (val) {
console.log(222)
if (this.tagNo === 107) {
if(this.tagNo1 === 1) {
this.modalData.umId = val.um_id

514
src/views/modules/part/umInformation.vue

@ -0,0 +1,514 @@
<template>
<div class="mod-config">
<!-- 查询条件 -->
<el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
<el-form-item :label="'单位编码'">
<el-input v-model="searchData.umId" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'单位名称'">
<el-input v-model="searchData.umName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'是否在用'">
<el-select clearable v-model="searchData.active" style="width: 120px">
<el-option label="是" value="Y"></el-option>
<el-option label="否" value="N"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="' '">
<el-button @click="getDataList()">查询</el-button>
<el-button type="primary" @click="addModal()">新增</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ "导出" }}
</download-excel>
</el-form-item>
</el-form>
<!-- 材料列表 -->
<el-table
:height="height"
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed === ''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="100"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="updateModal(scope.row)">编辑</a>
<a type="text" size="small" @click="delModal(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>
<!-- 分页插件 -->
<el-pagination style="margin-top: 0px"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 材料新增/编辑模态框 -->
<el-dialog :title="modalData.title" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="495px">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="单位编码" prop="umId" :rules="rules.umId">
<el-input v-model="modalData.umId" :disabled="modalDisableFlag" style="width: 221px"></el-input>
</el-form-item>
<el-form-item label="单位名称" prop="umName" :rules="rules.umName">
<el-input v-model="modalData.umName" style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="是否在用" prop="active" :rules="rules.active">
<el-select v-model="modalData.active" style="width: 221px">
<el-option label="是" value="Y"></el-option>
<el-option label="否" value="N"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-footer style="height:30px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="saveData()">保存</el-button>
<el-button type="primary" @click="modalFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- chooseList模态框 -->
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
<script>
import {
umInformationSearch, //
umInformationSave, //
umInformationEdit, //
umInformationDelete //
} from '@/api/part/umInformation.js'
import Chooselist from '@/views/modules/common/Chooselist'
export default {
components: {
Chooselist
},
watch: {
searchData: {
deep: true,
handler: function (newV, oldV) {
this.searchData.umId = this.searchData.umId.toUpperCase()
}
}
},
data () {
return {
//
exportData: [],
exportName: '计量单位' + this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: ['计量单位'],
exportFooter: [],
resultList: [],
// ======== ========
height: 200,
// ======== ========
pageIndex: 1,
pageSize: 50,
totalPage: 0,
//
searchData: {
site: this.$store.state.user.site,
umId: '',
umName: '',
active: '',
page: 1,
limit: 10
},
//
dataListLoading: false,
// ======== ========
modalData: {
flag: '',
title: '',
site: this.$store.state.user.site,
umId: '',
umName: '',
active: ''
},
// ======== ========
dataList: [],
// ======== ========
columnList: [
{
userId: this.$store.state.user.name,
functionId: 100003,
serialNumber: '100003Table1UmId',
tableId: '100003Table1',
tableName: '单位信息表',
columnProp: 'umId',
headerAlign: 'center',
align: 'center',
columnLabel: '单位编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 100003,
serialNumber: '100003Table1UmName',
tableId: '100003Table1',
tableName: '单位信息表',
columnProp: 'umName',
headerAlign: 'center',
align: 'center',
columnLabel: '单位名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 100003,
serialNumber: '100003Table1Active',
tableId: '100003Table1',
tableName: '单位信息表',
columnProp: 'active',
headerAlign: 'center',
align: 'center',
columnLabel: '是否在用',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
],
// ======== ========
rules: {
umId: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
umName: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
active: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
},
// ======== ========
modalFlag: false,
modalDisableFlag: false,
}
},
mounted () {
this.$nextTick(() => {
this.height = window.innerHeight - 210
})
},
created () {
this.getDataList()
},
methods: {
// ======== ========
/**
* 每页数
* @param val
*/
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
/**
* 当前页
* @param val
*/
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// ======== ========
/**
* 获取数据列表
*/
getDataList () {
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
umInformationSearch(this.searchData).then(({data}) => {
if (data.code === 0) {
this.dataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
this.$refs.selectDiv.setLengthAll( this.dataList.length)
}
this.dataListLoading = false
})
},
// ======== / ========
/**
* 材料信息新增模态框
*/
addModal () {
this.modalData = {
flag: '1',
title: '单位新增',
site: this.$store.state.user.site,
umId: '',
umName: '',
active: 'Y',
}
this.modalDisableFlag = false
this.modalFlag = true
},
/**
* 材料信息编辑模态框
* @param row
*/
updateModal (row) {
this.modalData = {
flag: '2',
title: '单位编辑',
site: row.site,
umId: row.umId,
umName: row.umName,
active: row.active
}
this.modalDisableFlag = true
this.modalFlag = true
},
// ======== // ========
/**
* 材料信息新增/编辑
*/
saveData () {
if (this.modalData.umId === '' || this.modalData.umId == null) {
this.$message.warning('请填写单位编码!')
return
}
if (this.modalData.umName === '' || this.modalData.umName == null) {
this.$message.warning('请填写单位名称!')
return
}
if (this.modalData.active === '' || this.modalData.active == null) {
this.$message.warning('请选择是否可用!')
return
}
if (this.modalData.flag === '1') {
umInformationSave(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
} else {
umInformationEdit(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}
},
/**
* 材料信息删除
*/
delModal (row) {
this.$confirm(`是否删除这条材料信息?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
umInformationDelete(row).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.partSelections = []
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
// ======== chooseList ========
/**
* 获取基础数据列表S
* @param val
* @param type
*/
getBaseList (val, type) {
this.tagNo = val
this.tagNo1 = type
this.$nextTick(() => {
let strVal = ''
if (val === 107) {
if(type === 1) {
strVal = this.modalData.umId
}
}
if (val === 108) {
if(type === 1) {
strVal = this.modalData.familyId
}
}
if (val === 109) {
if(type === 1) {
strVal = this.modalData.groupId
}
}
if (val === 110) {
if(type === 1) {
strVal = this.modalData.otherGroup1
}
}
this.$refs.baseList.init(val, strVal)
})
},
/**
* 列表方法的回调
* @param val
*/
getBaseData (val) {
if (this.tagNo === 107) {
if(this.tagNo1 === 1) {
this.modalData.umId = val.um_id
this.modalData.umName = val.um_name
}
}
if (this.tagNo === 108) {
if(this.tagNo1 === 1) {
this.modalData.familyId = val.family_id
this.modalData.familyName = val.family_name
}
}
if (this.tagNo === 109) {
if(this.tagNo1 === 1) {
this.modalData.groupId = val.group_id
this.modalData.groupName = val.group_name
}
}
},
// ======== ========
/**
* 导出excel
*/
async createExportData () {
this.searchData.limit = -1
this.searchData.page = 1
await umInformationSearch(this.searchData).then(({data}) => {
this.resultList = data.page.list
})
return this.resultList
},
startDownload () {
},
finishDownload () {
},
fields () {
let json = '{'
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
} else {
json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
}
})
json += '}'
let s = eval('(' + json + ')')
return s
}
}
}
</script>
<style scoped lang="scss">
/deep/ .customer-tab .el-tabs__content {
padding: 0px !important;
height: 459px;
}
</style>
Loading…
Cancel
Save