|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="80"
|
|
|
:options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
|
|
|
- :operation="operation" :exportList="exportList">
|
|
|
+ :operation="operation" :exportList="exportList" :replaceOrNotMap="true">
|
|
|
</template-page>
|
|
|
</template>
|
|
|
|
|
@@ -44,19 +44,6 @@ export default {
|
|
|
formDialog: false,
|
|
|
formData: {
|
|
|
companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
|
|
|
- settleNormType: 'INSTALL',
|
|
|
- types: {},
|
|
|
- typeName: '',
|
|
|
- type: '',
|
|
|
- parentCategory: {},
|
|
|
- parentCategoryName: '',
|
|
|
- parentCategoryId: '',
|
|
|
- category: {},
|
|
|
- categoryName: '',
|
|
|
- categoryId: '',
|
|
|
- label: '',
|
|
|
- normAmount: '',
|
|
|
- remark: ''
|
|
|
},
|
|
|
editIndex: null,
|
|
|
mainList: [],
|
|
@@ -80,6 +67,15 @@ export default {
|
|
|
methods: {
|
|
|
// 列表请求函数
|
|
|
getList: listPageV2,
|
|
|
+ getList(p) {
|
|
|
+ try {
|
|
|
+ var pam = JSON.parse(JSON.stringify(p))
|
|
|
+ this.editIndex = null
|
|
|
+ return listPageV2(pam)
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ },
|
|
|
// 列表导出函数
|
|
|
exportList: pageExport,
|
|
|
// 表格列解析渲染数据更改
|
|
@@ -87,79 +83,106 @@ export default {
|
|
|
if (item.jname === 'typeName') {
|
|
|
defaultData.render = (h, { row, index, column }) => {
|
|
|
return this.editIndex == index?(
|
|
|
- <el-form-item prop={`tableData.${index}.types`} rules={[{required: true, message: '域名不能为空', trigger: 'blur'}]}>
|
|
|
- <el-select
|
|
|
- // v-model={row.types}
|
|
|
- value={row.types}
|
|
|
- onInput={(val)=>{
|
|
|
- console.log(val)
|
|
|
- row.types=val
|
|
|
- }}
|
|
|
- placeholder="请选择" onChange={e=>{
|
|
|
- // this.formData.type = e.id
|
|
|
- // this.formData.typeName = e.orderSmallTypeText
|
|
|
- }}>
|
|
|
- {
|
|
|
- this.typeList.map((item, index) => {
|
|
|
- return <el-option key={item.id} label={item.orderSmallTypeText} value={item.id}></el-option>
|
|
|
- })
|
|
|
- }
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
+ <div class="redbordererr">
|
|
|
+ <el-form-item prop={`tableData.${index}.types`} rules={[{required: true, message: '工单类型不能为空', trigger: 'blur'}]}>
|
|
|
+ <el-select value-key="orderSmallTypeText" value={row.types} placeholder="请选择"
|
|
|
+ onInput={(val)=>{
|
|
|
+ row.types=val
|
|
|
+ }}>
|
|
|
+ {
|
|
|
+ this.typeList.map((item, index) => {
|
|
|
+ return <el-option key={item.id} label={item.orderSmallTypeText} value={item}></el-option>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
):(<div style="padding: 6px;">{row.typeName}</div>)
|
|
|
}
|
|
|
}
|
|
|
if (item.jname === 'parentCategoryName') {
|
|
|
defaultData.render = (h, { row, index, column }) => {
|
|
|
return this.editIndex == index?(
|
|
|
- <el-select v-model={this.formData.parentCategory} value-key="name" placeholder="请选择" onChange={e=>{
|
|
|
- this.formData.parentCategoryName = e.name
|
|
|
- this.formData.parentCategoryId = e.categoryId
|
|
|
- this.smallList = e.children
|
|
|
- }}>
|
|
|
- {
|
|
|
- this.mainList.map((item, index) => {
|
|
|
- return <el-option key={item.categoryId} label={item.name} value={item}></el-option>
|
|
|
- })
|
|
|
- }
|
|
|
- </el-select>
|
|
|
+ <div class="redbordererr">
|
|
|
+ <el-form-item prop={`tableData.${index}.parentCategory`} rules={[{required: true, message: '产品大类不能为空', trigger: 'blur'}]}>
|
|
|
+ <el-select value={row.parentCategory} value-key="name" placeholder="请选择"
|
|
|
+ onInput={(val)=>{
|
|
|
+ row.parentCategory=val
|
|
|
+ this.smallList = [...[{name: '通用', categoryId: 0}],...val.children]
|
|
|
+ }}>
|
|
|
+ {
|
|
|
+ this.mainList.map((item, index) => {
|
|
|
+ return <el-option key={item.categoryId} label={item.name} value={item}></el-option>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
):(<div style="padding: 6px;">{row.parentCategoryName}</div>)
|
|
|
}
|
|
|
}
|
|
|
if (item.jname === 'categoryName') {
|
|
|
defaultData.render = (h, { row, index, column }) => {
|
|
|
return this.editIndex == index? (
|
|
|
- <el-select v-model={this.formData.category} value-key="name" placeholder="请选择" onChange={e=>{
|
|
|
- this.formData.categoryName = e.name
|
|
|
- this.formData.categoryId = e.categoryId
|
|
|
- }}>
|
|
|
- {
|
|
|
- this.smallList.map((item, index) => {
|
|
|
- return <el-option key={item.id} label={item.name} value={item}></el-option>
|
|
|
- })
|
|
|
- }
|
|
|
- </el-select>
|
|
|
+ <div class="redbordererr">
|
|
|
+ <el-form-item prop={`tableData.${index}.category`} rules={[{required: true, message: '产品小类不能为空', trigger: 'blur'}]}>
|
|
|
+ <el-select value={row.category} value-key="name" placeholder="请选择"
|
|
|
+ onInput={(val)=>{
|
|
|
+ row.category=val
|
|
|
+ }}>
|
|
|
+ {
|
|
|
+ this.smallList.map((item, index) => {
|
|
|
+ return <el-option key={item.id} label={item.name} value={item}></el-option>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
):(<div style="padding: 6px;">{row.categoryName}</div>)
|
|
|
}
|
|
|
}
|
|
|
if (item.jname === 'label') {
|
|
|
defaultData.render = (h, { row, index, column }) => {
|
|
|
return this.editIndex == index? (
|
|
|
- <el-input type="text" v-model={this.formData.label} placeholder="请输入功率"></el-input>
|
|
|
+ <div class="redbordererr">
|
|
|
+ <el-form-item prop={`tableData.${index}.label`} rules={[{required: true, message: '功率不能为空', trigger: 'blur'}]}>
|
|
|
+ <el-input type="text" value={row.label} placeholder="请输入"
|
|
|
+ onInput={(val)=>{
|
|
|
+ row.label=val
|
|
|
+ }}>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
):(<div style="padding: 6px;">{row.label}</div>)
|
|
|
}
|
|
|
}
|
|
|
if (item.jname === 'normAmount') {
|
|
|
defaultData.render = (h, { row, index, column }) => {
|
|
|
return this.editIndex == index? (
|
|
|
- <el-input type="text" v-model={this.formData.normAmount} placeholder="请输入"></el-input>
|
|
|
+ <div class="redbordererr">
|
|
|
+ <el-form-item prop={`tableData.${index}.normAmount`} rules={[{required: true, message: '结算标准不能为空', trigger: 'blur'}]}>
|
|
|
+ <el-input type="text" value={row.normAmount} placeholder="请输入"
|
|
|
+ onInput={(val)=>{
|
|
|
+ row.normAmount=val
|
|
|
+ }}>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
):(<div style="padding: 6px;">{row.normAmount}</div>)
|
|
|
}
|
|
|
}
|
|
|
if (item.jname === 'remark') {
|
|
|
defaultData.render = (h, { row, index, column }) => {
|
|
|
return this.editIndex == index? (
|
|
|
- <el-input type="text" v-model={this.formData.remark} placeholder="请输入"></el-input>
|
|
|
+ <div class="redbordererr">
|
|
|
+ <el-form-item prop={`tableData.${index}.remark`}>
|
|
|
+ <el-input type="text" value={row.remark} placeholder="请输入"
|
|
|
+ onInput={(val)=>{
|
|
|
+ row.remark=val
|
|
|
+ }}>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
):(<div style="padding: 6px;">{row.remark}</div>)
|
|
|
}
|
|
|
defaultData.columnAttributes.width = 200
|
|
@@ -175,42 +198,41 @@ export default {
|
|
|
return (
|
|
|
<div class='operation-btns'>
|
|
|
{row.id?<el-button type="text" onClick={() => {
|
|
|
- if(this.editIndex != index){
|
|
|
- this.formData = Object.assign(row,{
|
|
|
- types: {orderSmallTypeText: row.typeName,id: row.type},
|
|
|
- parentCategory: {name: row.parentCategoryName,categoryId: row.parentCategoryId},
|
|
|
- category: {name: row.categoryName,categoryId: row.categoryId},
|
|
|
- })
|
|
|
- this.mainList.forEach(item =>{
|
|
|
- if(item.categoryId == row.parentCategoryId){
|
|
|
- this.smallList = item.children
|
|
|
- }
|
|
|
- })
|
|
|
- this.editIndex = index
|
|
|
- }else{
|
|
|
- this.$refs.pageRef.tableForm().validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.save('edit')
|
|
|
- } else {
|
|
|
- console.log('error submit!!');
|
|
|
- return false;
|
|
|
+ this.$refs.pageRef.tableForm().validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if(this.editIndex != index){
|
|
|
+ row = Object.assign(row,{
|
|
|
+ types: {orderSmallTypeText: row.typeName,id: row.type},
|
|
|
+ parentCategory: {name: row.parentCategoryName,categoryId: row.parentCategoryId},
|
|
|
+ category: {name: row.categoryName,categoryId: row.categoryId},
|
|
|
+ })
|
|
|
+ this.mainList.forEach(item =>{
|
|
|
+ if(item.categoryId == row.parentCategoryId){
|
|
|
+ this.smallList = [...[{name: '通用', categoryId: 0}],...item.children]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.editIndex = index
|
|
|
+ }else{
|
|
|
+ this.edit(row)
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
}}>{this.editIndex == index?'确定':'编辑'}</el-button>:null}
|
|
|
{!row.id?<el-button type="text" onClick={() => {
|
|
|
this.$refs.pageRef.tableForm().validate((valid) => {
|
|
|
if (valid) {
|
|
|
- console.log(valid)
|
|
|
- this.save('add')
|
|
|
+ this.add(row)
|
|
|
} else {
|
|
|
console.log('error submit!!');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}}>保存</el-button>:null}
|
|
|
- {row.id?<el-button type="text" style="color: #FF0000" onClick={() => {
|
|
|
- this.$confirm('请确认是否删除该数据, 是否继续?', '提示', {
|
|
|
+ <el-button type="text" style="color: #FF0000" onClick={() => {
|
|
|
+ row.id?this.$confirm('请确认是否删除该数据, 是否继续?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
@@ -225,14 +247,14 @@ export default {
|
|
|
this.$message.error(res.msg);
|
|
|
}
|
|
|
})
|
|
|
- });
|
|
|
- }}>删除</el-button>:null}
|
|
|
+ }): this.$refs.pageRef.deleteRowData(0)
|
|
|
+ }}>删除</el-button>
|
|
|
</div>
|
|
|
)
|
|
|
},
|
|
|
getMainList(){
|
|
|
getMainList({type: 2}).then(res => {
|
|
|
- this.mainList = res.data
|
|
|
+ this.mainList = [...[{name: '通用', categoryId: 0}],...res.data]
|
|
|
})
|
|
|
},
|
|
|
getTypeList(){
|
|
@@ -241,68 +263,68 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
addData() {
|
|
|
- if(this.editIndex != null){return false}
|
|
|
- this.editIndex = 0
|
|
|
- this.$refs.pageRef.insertionData(0,{
|
|
|
- types:""
|
|
|
- })
|
|
|
+ this.$refs.pageRef.tableForm().validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.editIndex = 0
|
|
|
+ this.$refs.pageRef.insertionData(0,{
|
|
|
+ settleNormType: 'INSTALL',
|
|
|
+ types: '',
|
|
|
+ parentCategory: '',
|
|
|
+ category: '',
|
|
|
+ label: '',
|
|
|
+ normAmount: '',
|
|
|
+ remark: ''
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
openForm() {
|
|
|
this.formDialog = true;
|
|
|
},
|
|
|
- add(){
|
|
|
- add(this.formData).then(res => {
|
|
|
+ add(row){
|
|
|
+ add({
|
|
|
+ settleNormType: 'INSTALL',
|
|
|
+ typeName: row.types.orderSmallTypeText,
|
|
|
+ type: row.types.id,
|
|
|
+ parentCategoryName: row.parentCategory.name,
|
|
|
+ parentCategoryId: row.parentCategory.categoryId,
|
|
|
+ categoryName: row.category.name,
|
|
|
+ categoryId: row.category.categoryId,
|
|
|
+ label: row.label,
|
|
|
+ normAmount: row.normAmount,
|
|
|
+ remark: row.remark
|
|
|
+ }).then(res => {
|
|
|
if(res.code ==200){
|
|
|
this.editIndex = null
|
|
|
this.$message({ type: 'success', message: `保存成功!` })
|
|
|
- this.formCancel()
|
|
|
this.$refs.pageRef.refreshList()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- edit(){
|
|
|
- edit(this.formData).then(res => {
|
|
|
+ edit(row){
|
|
|
+ edit({
|
|
|
+ id: row.id,
|
|
|
+ settleNormType: 'INSTALL',
|
|
|
+ typeName: row.types.orderSmallTypeText,
|
|
|
+ type: row.types.id,
|
|
|
+ parentCategoryName: row.parentCategory.name,
|
|
|
+ parentCategoryId: row.parentCategory.categoryId,
|
|
|
+ categoryName: row.category.name,
|
|
|
+ categoryId: row.category.categoryId,
|
|
|
+ label: row.label,
|
|
|
+ normAmount: row.normAmount,
|
|
|
+ remark: row.remark
|
|
|
+ }).then(res => {
|
|
|
if(res.code ==200){
|
|
|
this.editIndex = null
|
|
|
this.$message({ type: 'success', message: `保存成功!` })
|
|
|
- this.formCancel()
|
|
|
this.$refs.pageRef.refreshList()
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
- save(type){
|
|
|
- if(!this.formData.type){
|
|
|
- return this.$message.warning('请选择工单类型!');
|
|
|
- }else if(!this.formData.parentCategoryName){
|
|
|
- return this.$message.warning('请选择产品大类!');
|
|
|
- }else if(!this.formData.categoryName){
|
|
|
- return this.$message.warning('请选择产品小类!');
|
|
|
- }else if(!this.formData.label){
|
|
|
- return this.$message.warning('请输入功率!');
|
|
|
- }else if(!this.formData.normAmount){
|
|
|
- return this.$message.warning('请输入结算标准费用!');
|
|
|
- }else{
|
|
|
- if(type == 'add'){
|
|
|
- this.add()
|
|
|
- }else{
|
|
|
- this.edit()
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- formConfirm() {
|
|
|
- this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
|
|
|
- if (valid) {
|
|
|
- ([add, edit][this.formDialogType])({
|
|
|
- ...this.formData,
|
|
|
- fileUrl:this.formData.fileUrl.map(item=>item.url).join(",")
|
|
|
- }).then(res => {
|
|
|
- this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
|
|
|
- this.formCancel()
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -311,4 +333,10 @@ export default {
|
|
|
.tab{
|
|
|
padding: 20px 20px 0 20px;
|
|
|
}
|
|
|
+ .redbordererr {
|
|
|
+ ::v-deep .el-form-item {
|
|
|
+ margin: 0 !important;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|