¶Ô±ÈÐÂÎļþ |
| | |
| | | <style scoped> |
| | | .plan { |
| | | width: 100%; |
| | | } |
| | | |
| | | .title { |
| | | height: 60px; |
| | | width: calc(100% - 20px); |
| | | background-color: white; |
| | | margin: 5px 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 0 30px; |
| | | } |
| | | |
| | | .thing { |
| | | margin: 10px; |
| | | padding: 15px; |
| | | background-color: white; |
| | | height: calc(100vh - 15vh); |
| | | } |
| | | </style> |
| | | <style> |
| | | .plan .has-gutter tr th { |
| | | background-color: #f5f7fa !important; |
| | | color: #333; |
| | | } |
| | | |
| | | .plan .cell { |
| | | color: #333; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | | <div class="plan"> |
| | | <div class="title"> |
| | | <span>项ç®åç§°ï¼</span> |
| | | <el-input v-model="search.name" size="medium" style="width: 200px;margin-right: 20px;"></el-input> |
| | | <span>æ£éªæ¶é´ï¼</span> |
| | | <el-date-picker v-model="search.date" type="daterange" range-separator="è³" start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" size="medium" style="margin-right: 20px;"> |
| | | </el-date-picker> |
| | | <span>æ£éªäººï¼</span> |
| | | <el-input v-model="search.userName" size="medium" style="width: 200px;margin-right: 20px;"></el-input> |
| | | <el-button size="small" type="primary">æ¥è¯¢</el-button> |
| | | <el-button size="small">éç½®</el-button> |
| | | </div> |
| | | <div class="thing"> |
| | | <el-table :data="tableData" style="width: 100%;" row-key="id" default-expand-all |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" :key="upIndex"> |
| | | <el-table-column type="index" width="50" label="åºå·"> |
| | | </el-table-column> |
| | | <el-table-column prop="date" label="ç³è¯·åå·"> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="æ£éªç»æ"> |
| | | </el-table-column> |
| | | <el-table-column prop="address" label="å°å"> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" type="primary" v-if="isIfReport(scope.row)">䏿¥</el-button> |
| | | <el-button size="mini" type="warning" @click="openUpDia(scope.row)" |
| | | v-else-if="scope.row.insId==undefined&&scope.row.address==null">åé
</el-button> |
| | | <el-button size="mini" type="success" @click="openUpInsDia(scope.row)" |
| | | v-else-if="scope.row.insId==undefined&&scope.row.name==null">æ£éª</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <el-dialog title="åé
设å¤å人å" :visible.sync="upDia" width="500px" top="30vh"> |
| | | <div class="body"> |
| | | <el-row style="line-height: 46px;"> |
| | | <el-col :span="4" style="font-size: 14px;text-align: right;">人å:</el-col> |
| | | <el-col :span="16" :offset="1"> |
| | | <el-input v-model="upData.address" size="small" clearable></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitUpData">ç¡® å®</el-button> |
| | | <el-button @click="upDia = false">å æ¶</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="æ£éª" :visible.sync="upInsDia" width="500px"> |
| | | <div class="body" style="max-height: 50vh;overflow-y: auto;"> |
| | | <el-row style="line-height: 46px;"> |
| | | <el-col :span="4" style="font-size: 14px;text-align: right;">æ ·åç¼ç ï¼</el-col> |
| | | <el-col :span="8">{{upData.date}}</el-col> |
| | | <el-col :span="4" style="font-size: 14px;text-align: right;">æ ·ååç§°ï¼</el-col> |
| | | <el-col :span="8">{{upData.date}}</el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 46px;"> |
| | | <el-col :span="4" style="font-size: 14px;text-align: right;">æ£éªé¡¹ç®ï¼</el-col> |
| | | <el-col :span="8">{{upData.date}}</el-col> |
| | | <el-col :span="4" style="font-size: 14px;text-align: right;">åä½ï¼</el-col> |
| | | <el-col :span="8">{{upData.date}}</el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 46px;"> |
| | | <el-col :span="4" style="font-size: 14px;text-align: right;">æ åå¼ï¼</el-col> |
| | | <el-col :span="8">{{upData.date}}</el-col> |
| | | <el-col :span="4" style="font-size: 14px;text-align: right;">å
æ§å¼ï¼</el-col> |
| | | <el-col :span="8">{{upData.date}}</el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 46px;"> |
| | | <el-col style="text-align: right;"><el-button size="mini" @click="addRes">æ·»å æ£éªå¼</el-button></el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col> |
| | | <el-table :data="upData.res" border style="width: 99.9%;" :key="upIndex2"> |
| | | <el-table-column type="index" width="100" label="åºå·"> |
| | | </el-table-column> |
| | | <el-table-column label="æ£éªå¼"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model.number="scope.row.number" size="small" clearable placeholder="请è¾å
¥" |
| | | @change="(val)=>scope.row.number = isNaN(val)?null:val"> |
| | | </el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="60"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" type="text" |
| | | @click.native.prevent="deleteRow(scope.$index, upData.res)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitUpData">æ 交</el-button> |
| | | <el-button @click="upInsDia = false">å æ¶</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | search: { |
| | | name: null, |
| | | date: [], |
| | | userName: null, |
| | | }, |
| | | tableData: [{ |
| | | id: 1, |
| | | insId: 123, |
| | | date: '2016-05-02', |
| | | name: null, |
| | | address: '䏿µ·å¸æ®éåºéæ²æ±è·¯ 1518 å¼', |
| | | children: [{ |
| | | id: 33, |
| | | date: '2016-05-01', |
| | | name: null, |
| | | res: '[{"number": 1},{"number": 2}]', |
| | | address: '䏿µ·å¸æ®éåºéæ²æ±è·¯ 1519 å¼' |
| | | }, { |
| | | id: 34, |
| | | date: '2016-05-01', |
| | | name: null, |
| | | res: '[{"number": 1,"res": "ä¸åæ ¼"},{"number": 2}]', |
| | | address: '䏿µ·å¸æ®éåºéæ²æ±è·¯ 1519 å¼' |
| | | }] |
| | | }, { |
| | | id: 2, |
| | | insId: 123, |
| | | date: '2016-05-04', |
| | | name: null, |
| | | address: '䏿µ·å¸æ®éåºéæ²æ±è·¯ 1517 å¼', |
| | | children: [] |
| | | }, { |
| | | id: 3, |
| | | insId: 123, |
| | | date: '2016-05-01', |
| | | children: [{ |
| | | id: 31, |
| | | date: '2016-05-01', |
| | | name: null, |
| | | res: '[{"number": 1},{"number": 2}]', |
| | | address: '䏿µ·å¸æ®éåºéæ²æ±è·¯ 1519 å¼' |
| | | }, { |
| | | id: 32, |
| | | date: '2016-05-01', |
| | | name: null, |
| | | res: '[]', |
| | | address: null |
| | | }] |
| | | }], |
| | | upDia: false, |
| | | upData: {}, |
| | | upIndex: 0, |
| | | upInsDia: false, |
| | | upIndex2: 0 |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.selectDataList() |
| | | }, |
| | | methods: { |
| | | selectDataList() { |
| | | this.tableData.forEach(a => { |
| | | a.code = '[1]' |
| | | if (a.children != undefined) { |
| | | a.children.forEach(b => { |
| | | b.code = '[2]' |
| | | b.res = JSON.parse(b.res) |
| | | }) |
| | | } |
| | | }) |
| | | this.upIndex++ |
| | | }, |
| | | isIfReport(row) { |
| | | var count = 0 |
| | | if (row.children == undefined) return false |
| | | row.children.forEach(a => { |
| | | if (a.name != null && a.name != undefined) count++ |
| | | }) |
| | | return row.insId != undefined && count == row.children.length |
| | | }, |
| | | openUpDia(row) { |
| | | this.upDia = true |
| | | this.upData = { |
| | | id: row.id, |
| | | address: row.address |
| | | } |
| | | }, |
| | | submitUpData() { |
| | | this.tableData.forEach(a => { |
| | | a.children.forEach(b => { |
| | | if (b.id == this.upData.id) { |
| | | b.address = this.upData.address |
| | | } |
| | | }) |
| | | }) |
| | | this.$message.success('ä¿®æ¹æå') |
| | | this.upIndex++ |
| | | this.upDia = false |
| | | }, |
| | | openUpInsDia(row) { |
| | | this.upInsDia = true |
| | | this.upData = this.HaveJson(row) |
| | | }, |
| | | deleteRow(index, rows) { |
| | | rows.splice(index, 1); |
| | | }, |
| | | addRes() { |
| | | this.upData.res.push({ |
| | | "number": null |
| | | }) |
| | | this.upIndex2++ |
| | | } |
| | | } |
| | | } |
| | | </script> |