|
@@ -10,7 +10,7 @@ import TemplatePage from '@/components/template/template-page-1.vue'
|
|
|
import import_mixin from '@/components/template/import_mixin.js'
|
|
|
import ImageUpload from '@/components/file-upload'
|
|
|
import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
|
|
|
-import { listPageV2,pageExport, getDetail, add, edit, del, getExamine } from "@/api/workOrder/rewardsPunishmentsOrder";
|
|
|
+import { listPageV2,pageExport, add, edit, del, getMainList, getTypeList } from "@/api/workOrder/settlementStandardInstall";
|
|
|
export default {
|
|
|
components: { TemplatePage, ImageUpload },
|
|
|
mixins: [import_mixin],
|
|
@@ -44,7 +44,24 @@ 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: [],
|
|
|
+ smallList: [],
|
|
|
+ typeList: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -57,7 +74,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created(){
|
|
|
-
|
|
|
+ this.getMainList()
|
|
|
+ this.getTypeList()
|
|
|
},
|
|
|
methods: {
|
|
|
// 列表请求函数
|
|
@@ -66,15 +84,86 @@ export default {
|
|
|
exportList: pageExport,
|
|
|
// 表格列解析渲染数据更改
|
|
|
columnParsing(item, defaultData) {
|
|
|
- if (item.jname === 'fileUrl') {
|
|
|
+ if (item.jname === 'typeName') {
|
|
|
defaultData.render = (h, { row, index, column }) => {
|
|
|
- return (
|
|
|
- <div style="padding:0 6px;cursor: pointer;">
|
|
|
- {row.fileUrl ? row.fileUrl.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
|
|
|
- </div>
|
|
|
- )
|
|
|
+ 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 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 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 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 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 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 style="padding: 6px;">{row.remark}</div>)
|
|
|
+ }
|
|
|
+ defaultData.columnAttributes.width = 200
|
|
|
+ }
|
|
|
return defaultData
|
|
|
},
|
|
|
// 监听勾选变化
|
|
@@ -85,35 +174,121 @@ export default {
|
|
|
operation(h, { row, index, column }) {
|
|
|
return (
|
|
|
<div class='operation-btns'>
|
|
|
- {row.id?<el-button type="text" onClick={() => {
|
|
|
-
|
|
|
- }}>编辑</el-button>:null}
|
|
|
- {!row.id?<el-button type="text" onClick={() => {
|
|
|
-
|
|
|
- }}>保存</el-button>:null}
|
|
|
- <el-button type="text" onClick={() => {
|
|
|
-
|
|
|
- }}>删除</el-button>
|
|
|
+ {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.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')
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }}>保存</el-button>:null}
|
|
|
+ {row.id?<el-button type="text" style="color: #FF0000" onClick={() => {
|
|
|
+ this.$confirm('请确认是否删除该数据, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ del({
|
|
|
+ id: row.id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({ type: 'success', message: '删除成功!' })
|
|
|
+ this.$refs.pageRef.refreshList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }}>删除</el-button>:null}
|
|
|
</div>
|
|
|
)
|
|
|
},
|
|
|
- getExamine(){
|
|
|
- getExamine({pageNum: 1,pageSize: -1,params: []}).then(res => {
|
|
|
- this.examineList = res.data.records
|
|
|
+ getMainList(){
|
|
|
+ getMainList({type: 2}).then(res => {
|
|
|
+ this.mainList = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getTypeList(){
|
|
|
+ getTypeList({pageNum: 1,pageSize: -1,params: [{param: 'a.order_type',compare: '=',value: 'INSTALL'},{param: 'a.status',compare: '=',value: true}]}).then(res => {
|
|
|
+ this.typeList = res.data.records
|
|
|
})
|
|
|
},
|
|
|
addData() {
|
|
|
- this.formDialogType = 0
|
|
|
- this.openForm()
|
|
|
+ if(this.editIndex != null){return false}
|
|
|
+ this.editIndex = 0
|
|
|
+ this.$refs.pageRef.insertionData(0,{
|
|
|
+ types:""
|
|
|
+ })
|
|
|
},
|
|
|
openForm() {
|
|
|
this.formDialog = true;
|
|
|
},
|
|
|
- formCancel() {
|
|
|
- this.$refs.formRef.$refs.inlineForm.clearValidate()
|
|
|
- this.$data.formData = this.$options.data().formData
|
|
|
- this.formDialog = false
|
|
|
- },
|
|
|
+ add(){
|
|
|
+ add(this.formData).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 => {
|
|
|
+ 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) {
|