| | |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unit" label="单位" align="center" min-width="100"> |
| | | <!-- <el-table-column prop="unit" label="单位" align="center" min-width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.unit" clearable size="small" style="width: 100%;" :disabled="active>1"> |
| | | <el-option v-for="(a, i) in units" :key="i" :label="a.label" :value="a.value"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | <!-- <el-table-column prop="isLeave" label="是否留样" align="center" min-width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.isLeave" size="small" :disabled="active>1"> |
| | |
| | | this.$message.error('请输入样品型号') |
| | | } else if (!this.sampleList.every(m => m.standardMethodListId)) { |
| | | this.$message.error('请选择检验标准') |
| | | } else if (!this.sampleList.every(m => m.unit)) { |
| | | this.$message.error('请输入样品的单位') |
| | | } else { |
| | | this.saveLoad = true |
| | | this.$axios.post(this.$api.insOrder.addInsOrder, { |
| | |
| | | </el-radio-group> |
| | | </div> |
| | | <div class="center-box"> |
| | | <table border="1" class="tables" cellpadding="10" v-for="(item,index) in tableList" :key="index" |
| | | > |
| | | <table border="1" class="tables" cellpadding="10" v-for="(item,index) in tableList" :key="index"> |
| | | <tbody> |
| | | <tr v-for="(m,i) in item.arr" :key="i"> |
| | | <td :id='item.templateId+"-"+n.i+"-"+n.r+"-"+n.c' v-for="(n,j) in m" :key="j" |
| | |
| | | this.tableList[0].insProductResult[m] = JSON.stringify(this.tableList[0].insProductResult[m]) |
| | | break; |
| | | case 'resValue': |
| | | console.log(this.param) |
| | | this.tableList[0].lastValue = value.v.v |
| | | break; |
| | | case 'insResult': |
| | |
| | | }).then(res => { |
| | | if (res.code === 200 && res.data) { |
| | | this.equipOptions = res.data.map(m => { |
| | | m.value = m.factoryNo |
| | | m.value = m.managementNumber |
| | | m.label = m.deviceName |
| | | return m |
| | | }) |
| | |
| | | }) |
| | | }, |
| | | saveInsContext(){ |
| | | this.$axios.post(this.$api.insOrderPlan.saveInsContext, this.param, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | this.$axios.post(this.$api.insOrderPlan.saveInsContext, { |
| | | param: JSON.stringify(this.param) |
| | | }).then(res => { |
| | | if (res.code == 201) { |
| | | this.$message.error('保存失败') |
| | |
| | | dataVerification: false, // '数据验证' |
| | | frozenMode: false, // '冻结方式' |
| | | currencyFormat: false, //货币格式 |
| | | percentageFormat: false, //百分比格式 |
| | | percentageFormat: true, //百分比格式 |
| | | numberDecrease: true, // '减少小数位数' |
| | | numberIncrease: true, // '增加小数位数 |
| | | moreFormats: false, // '更多格式' |
| | | moreFormats: true, // '更多格式' |
| | | strikethrough: false, // '删除线 (Alt+Shift+5)' |
| | | underline: false, // '下划线 (Alt+Shift+6)' |
| | | italic: false, // '斜体 (Ctrl+I)' |
| | |
| | | :total="total"> |
| | | </el-pagination> |
| | | </div> |
| | | <el-dialog title="编辑" :visible.sync="upDia" :width="data.row==1?'500px':500+data.row * 200 + 'px'" append-to-body> |
| | | <el-dialog title="编辑" :visible.sync="upDia" :width="data.row==1?'500px':540+data.row * 200 + 'px'" append-to-body> |
| | | <div class="body" style="max-height: 550px;overflow-y: auto;padding: 5px 10px 5px 0;"> |
| | | <div v-if="data.row > 1"> |
| | | <div v-for="(a, ai) in upHead" :key="ai" style="line-height: 50px;"> |
| | |
| | | <el-button type="primary" @click="saveUpData" :loading="upLoad">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="新增" :visible.sync="addDia" :width="data.row==1?'500px':500+data.row * 200 + 'px'" append-to-body> |
| | | <el-dialog title="新增" :visible.sync="addDia" :width="data.row==1?'500px':540+data.row * 200 + 'px'" append-to-body> |
| | | <div class="body" v-if="addDia" style="max-height: 550px;overflow-y: auto;padding: 5px 10px 5px 0;"> |
| | | <div v-if="data.row > 1"> |
| | | <div v-for="(a, ai) in upHead" :key="ai" style="line-height: 50px;"> |
| | | <el-col :span="6/data.row" style="text-align: right;"><span class="required-span" |
| | | <el-col :span="6/data.row" style="text-align: right;" :offset="1"><span class="required-span" |
| | | v-if="showAddReq(a.label)">* |
| | | </span>{{a.value}}:</el-col> |
| | | <el-col :span="16/data.row" :offset="1"> |
| | | <el-col :span="16/data.row"> |
| | | <el-input v-model="upData[a.label]" size="small" clearable :placeholder="`请输入${a.value}`" |
| | | v-if="showType(a.label, data.selectField) == null&&!showUpload(a.label)&&!showCascader(a.label)"></el-input> |
| | | <el-select v-model="upData[a.label]" size="small" v-if="showType(a.label, data.selectField) != null" |
| | |
| | | } |
| | | }, |
| | | requiredAdd: ['sonLaboratory', 'inspectionItem', 'manHour', 'inspectionItemType', 'inspectionValueType', |
| | | 'unit', 'method', 'price', 'manDay' |
| | | 'unit', 'method', 'price', 'manDay', 'templateId' |
| | | ], |
| | | requiredUp: ['sonLaboratory', 'inspectionItem', 'manHour', 'inspectionItemType', 'inspectionValueType', |
| | | 'unit', 'method', 'price', 'manDay' |
| | | 'unit', 'method', 'price', 'manDay', 'templateId' |
| | | ] |
| | | }, |
| | | testObjectData: { |
| | |
| | | </el-form-item> |
| | | <el-form-item label="当前状态:"> |
| | | <el-select v-model="formData2.deviceStatus" placeholder="请选择" size="small" style="width:100%"> |
| | | <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" :value="item.value"> |
| | | <el-option v-for="item in deviceStatusList" :key="item.id" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | category: "设备状态" |
| | | }).then(res => { |
| | | this.deviceStatusList = res.data |
| | | this.deviceStatusList.forEach(a=>{ |
| | | if(!isNaN(a.value)){ |
| | | a.value = parseInt(a.value) |
| | | } |
| | | }) |
| | | this.componentData.tagField.deviceStatus.select = res.data |
| | | }) |
| | | this.$axios.post(this.$api.enums.selectEnumByCategory, { |
| | |
| | | <style scoped> |
| | | .title { |
| | | height: 60px; |
| | | line-height: 60px; |
| | | } |
| | | .title { |
| | | height: 60px; |
| | | line-height: 60px; |
| | | } |
| | | |
| | | .search { |
| | | background-color: #fff; |
| | | height: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .search { |
| | | background-color: #fff; |
| | | height: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .search_thing { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 50px; |
| | | } |
| | | .search_thing { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 50px; |
| | | } |
| | | |
| | | .search_label { |
| | | width: 120px; |
| | | font-size: 14px; |
| | | text-align: right; |
| | | } |
| | | .search_label { |
| | | width: 120px; |
| | | font-size: 14px; |
| | | text-align: right; |
| | | } |
| | | |
| | | .search_input { |
| | | width: calc(100% - 120px); |
| | | } |
| | | .search_input { |
| | | width: calc(100% - 120px); |
| | | } |
| | | |
| | | .table { |
| | | margin-top: 10px; |
| | | background-color: #fff; |
| | | width: calc(100% - 40px); |
| | | height: calc(100% - 60px - 80px - 10px - 40px); |
| | | padding: 20px; |
| | | } |
| | | .table { |
| | | margin-top: 10px; |
| | | background-color: #fff; |
| | | width: calc(100% - 40px); |
| | | height: calc(100% - 60px - 80px - 10px - 40px); |
| | | padding: 20px; |
| | | } |
| | | |
| | | .el-form-item { |
| | | margin-bottom: 16px; |
| | | } |
| | | .el-form-item { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | >>>.el-table tbody tr:hover > td { |
| | | background-color: transparent !important; |
| | | >>>.el-table tbody tr:hover>td { |
| | | background-color: transparent !important; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | | <div class="inspection_order"> |
| | | <div style="width: 100%;height: 100%;"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="padding-left: 20px;">费用统计</el-col> |
| | | <div class="inspection_order"> |
| | | <div style="width: 100%;height: 100%;"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="padding-left: 20px;">费用统计</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button size="small" type="primary">OA推送</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="search"> |
| | | <el-button size="small" type="primary">OA推送</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="search"> |
| | | <div class="search_thing"> |
| | | <div class="search_label">时间范围:</div> |
| | | <div class="search_input"> |
| | | <el-date-picker |
| | | v-model="dates" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | format="yyyy-MM-dd HH:mm:ss" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | size="small"> |
| | | <div class="search_label">时间范围:</div> |
| | | <div class="search_input"> |
| | | <el-date-picker v-model="dates" type="daterange" range-separator="至" format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" size="small" |
| | | @change="datesChange" :key="index2"> |
| | | </el-date-picker> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">委托人:</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请输入" clearable |
| | | v-model="componentData.entity.name" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing" style="padding-left: 30px;"> |
| | | <el-button size="small" @click="refresh()">重 置</el-button> |
| | | <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <ValueTable ref="ValueTable" :url="$api.insOrder.costStatistics" :componentData="componentData" |
| | | :key="upIndex" @handleWeave="handleWeave"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">委托人:</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请输入" clearable |
| | | v-model="componentData.entity.name" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing" style="padding-left: 30px;"> |
| | | <el-button size="small" @click="refresh()">重 置</el-button> |
| | | <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <ValueTable ref="ValueTable" :url="$api.insOrder.costStatistics" :componentData="componentData" :key="upIndex" |
| | | @handleWeave="handleWeave" /> |
| | | </div> |
| | | </div> |
| | | <el-dialog title="在线编制" :visible.sync="claimVisible" width="70%" :modal-append-to-body="false"> |
| | | <Word style="height:70vh" v-if="claimVisible" ref="Word"/> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="claimVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmClaim">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | <Word style="height:70vh" v-if="claimVisible" ref="Word" /> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="claimVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmClaim">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ValueTable from '../tool/value-table.vue' |
| | | import ValueTable from '../tool/value-table.vue' |
| | | import Word from '../tool/word.vue' |
| | | export default { |
| | | components: { |
| | | ValueTable, |
| | | export default { |
| | | components: { |
| | | ValueTable, |
| | | Word, |
| | | }, |
| | | data() { |
| | | return { |
| | | componentData: { |
| | | entity: { |
| | | name: null, |
| | | orderBy: { |
| | | field: 'id,ins_sample_id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: false, |
| | | highlight:false, |
| | | do: [], |
| | | linkEvent:{}, |
| | | spanConfig:{ |
| | | }, |
| | | data() { |
| | | return { |
| | | componentData: { |
| | | entity: { |
| | | name: null, |
| | | dates: null, |
| | | orderBy: { |
| | | field: 'id,ins_sample_id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | init: false, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: false, |
| | | highlight: false, |
| | | do: [], |
| | | linkEvent: {}, |
| | | spanConfig: { |
| | | //合并行 |
| | | rows:[ |
| | | { |
| | | name:'createTime', |
| | | index:1 |
| | | rows: [{ |
| | | name: 'createTime', |
| | | index: 1 |
| | | }, |
| | | { |
| | | name:'entrustCode', |
| | | index:2 |
| | | name: 'entrustCode', |
| | | index: 2 |
| | | }, |
| | | { |
| | | name:'company', |
| | | index:8 |
| | | name: 'company', |
| | | index: 8 |
| | | }, |
| | | { |
| | | name:'name', |
| | | index:9 |
| | | name: 'name', |
| | | index: 9 |
| | | }, |
| | | ], |
| | | // 特殊的合并行,根据main和rows的name来合并 |
| | | special:{ |
| | | main:'insSampleId', |
| | | rows:[ |
| | | { |
| | | name:'sample', |
| | | index:3 |
| | | special: { |
| | | main: 'insSampleId', |
| | | rows: [{ |
| | | name: 'sample', |
| | | index: 3 |
| | | }, |
| | | { |
| | | name:'model', |
| | | index:4 |
| | | name: 'model', |
| | | index: 4 |
| | | }, |
| | | { |
| | | name:'num', |
| | | index:5 |
| | | name: 'num', |
| | | index: 5 |
| | | }, |
| | | { |
| | | name:'price', |
| | | index:6 |
| | | name: 'price', |
| | | index: 6 |
| | | }, |
| | | ] |
| | | } |
| | | }, |
| | | tagField: { |
| | | type: { |
| | | select: [{ |
| | | value: 0, |
| | | type: 'success', |
| | | label: '普通' |
| | | }, { |
| | | value: 1, |
| | | type: 'warning', |
| | | label: '优先' |
| | | }, { |
| | | value: 2, |
| | | type: 'danger', |
| | | label: '紧急' |
| | | }] |
| | | }, |
| | | createUser: { |
| | | select: [] |
| | | } |
| | | }, |
| | | selectField: {}, |
| | | requiredAdd: [], |
| | | requiredUp: [] |
| | | }, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | claimVisible:false, |
| | | dates: [] |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.entityCopy = this.HaveJson(this.componentData.entity) |
| | | this.getPower() |
| | | }, |
| | | methods: { |
| | | refreshTable() { |
| | | this.$refs['ValueTable'].selectList() |
| | | }, |
| | | refresh() { |
| | | this.componentData.entity = this.HaveJson(this.entityCopy) |
| | | this.upIndex++ |
| | | }, |
| | | handleWeave(){ |
| | | tagField: { |
| | | type: { |
| | | select: [{ |
| | | value: 0, |
| | | type: 'success', |
| | | label: '普通' |
| | | }, { |
| | | value: 1, |
| | | type: 'warning', |
| | | label: '优先' |
| | | }, { |
| | | value: 2, |
| | | type: 'danger', |
| | | label: '紧急' |
| | | }] |
| | | }, |
| | | createUser: { |
| | | select: [] |
| | | } |
| | | }, |
| | | selectField: {}, |
| | | requiredAdd: [], |
| | | requiredUp: [] |
| | | }, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | claimVisible: false, |
| | | dates: [], |
| | | index2: 0 |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getDates() |
| | | this.refreshTable() |
| | | this.entityCopy = this.HaveJson(this.componentData.entity) |
| | | this.getPower() |
| | | }, |
| | | methods: { |
| | | getDates(){ |
| | | //当前月第一天 |
| | | var y = new Date().getFullYear(); //获取年份 |
| | | var m = new Date().getMonth() + 1; //获取月份 |
| | | var d = "01"; |
| | | m = m < 10 ? "0" + m : m; //月份补 0 |
| | | let startDate = [y, m, d].join("-"); |
| | | //当前月最后一天 |
| | | var y = new Date().getFullYear(); //获取年份 |
| | | var m = new Date().getMonth() + 1; //获取月份 |
| | | var d = new Date(y, m, 0).getDate(); //获取当月最后一日 |
| | | m = m < 10 ? "0" + m : m; //月份补 0 |
| | | d = d < 10 ? "0" + d : d; //日数补 0 |
| | | let endDate = [y, m, d].join("-"); |
| | | this.dates = [startDate, endDate] |
| | | this.index2++ |
| | | this.componentData.entity.dates = `["${startDate}","${endDate}"]` |
| | | }, |
| | | refreshTable() { |
| | | this.$refs['ValueTable'].selectList() |
| | | }, |
| | | refresh() { |
| | | this.componentData.entity = this.HaveJson(this.entityCopy) |
| | | this.componentData.init = true |
| | | this.getDates() |
| | | this.upIndex++ |
| | | }, |
| | | handleWeave() { |
| | | this.claimVisible = true; |
| | | }, |
| | | // 权限分配 |
| | | getPower(radio) { |
| | | let power = JSON.parse(sessionStorage.getItem('power')) |
| | | let up = false |
| | | let del = false |
| | | let add = false |
| | | for (var i = 0; i < power.length; i++) { |
| | | if (power[i].menuMethod == 'upInsOrder') { |
| | | up = true |
| | | } |
| | | if (power[i].menuMethod == 'addInsOrder') { |
| | | add = true |
| | | } |
| | | } |
| | | if (!up) { |
| | | this.componentData.do.splice(4, 1) |
| | | } |
| | | }, |
| | | handleClose() { |
| | | this.upLoad = false; |
| | | }, |
| | | confirmClaim(){ |
| | | console.log(11111111111,this.$refs.Word.getValue()) |
| | | // 权限分配 |
| | | getPower(radio) { |
| | | let power = JSON.parse(sessionStorage.getItem('power')) |
| | | let up = false |
| | | let del = false |
| | | let add = false |
| | | for (var i = 0; i < power.length; i++) { |
| | | if (power[i].menuMethod == 'upInsOrder') { |
| | | up = true |
| | | } |
| | | if (power[i].menuMethod == 'addInsOrder') { |
| | | add = true |
| | | } |
| | | } |
| | | if (!up) { |
| | | this.componentData.do.splice(4, 1) |
| | | } |
| | | }, |
| | | handleClose() { |
| | | this.upLoad = false; |
| | | }, |
| | | confirmClaim() { |
| | | console.log(11111111111, this.$refs.Word.getValue()) |
| | | }, |
| | | datesChange(val){ |
| | | if(val == null){ |
| | | return |
| | | } |
| | | this.componentData.entity.dates = JSON.stringify(val) |
| | | this.$refs['ValueTable'].selectList() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | v-model="componentData.entity.sampleType" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">样品型号:</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请输入" clearable |
| | | v-model="componentData.entity.sampleModel" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">样品编号:</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请输入" clearable |
| | | v-model="componentData.entity.sampleType" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">样品型号:</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请输入" clearable |
| | | v-model="componentData.entity.sampleType" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | v-model="componentData.entity.sampleCode" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">下单时间:</div> |
| | | <div class="search_input"> |
| | | <el-date-picker style="width:100%" v-model="componentData.entity.createTime" |
| | | type="datetime" |
| | | type="date" |
| | | size="small" |
| | | format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | clearable |
| | | placeholder="选择日期"> |
| | | </el-date-picker> |
| | |
| | | entity: { |
| | | entrustCode: null, |
| | | sampleType: null, |
| | | sampleName: null, |
| | | sampleModel: null, |
| | | sampleCode: null, |
| | | state: 0, |
| | | orderBy: { |
| | | field: 'id', |
| | |
| | | <!-- </el-col> --> |
| | | </el-row> |
| | | <el-row class="standard_table" v-loading="tableLoad"> |
| | | <el-table class="el-table" :data="standardList" style="width: 100%;height: 220px !important;overflow-y: auto;" tooltip-effect="dark" |
| | | highlight-current-row @row-click="rowClick" ref="standard"> |
| | | <el-table class="el-table" :data="standardList" style="width: 100%;height: 220px !important;overflow-y: auto;" |
| | | tooltip-effect="dark" highlight-current-row @row-click="rowClick" ref="standard"> |
| | | <el-table-column prop="code" label="标准编号" show-overflow-tooltip width="180"> |
| | | <template slot-scope="scope"> |
| | | <span style="color: red;font-size: 14px;">{{scope.row['code']}}</span> |
| | |
| | | <el-table-column prop="price" label="单价(元)" width="90" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="manHour" label="工时(H)" width="90" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="manHourGroup" label="工时分组" width="100" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="deviceGroup" label="设备组" width="120" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="section" label="区间" width="120" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="section" label="操作" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="sectionUp(scope.row)">区间设置</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-row> |
| | | </div> |
| | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="addProductDia = false">取 消</el-button> |
| | | <el-button type="primary" @click="addStandardProductDo" :loading="addLoad3">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="区间设置" :visible.sync="sectionUpDia" width="500px"> |
| | | <div class="body" style="padding: 5px 0;"> |
| | | <el-table :data="sectionList" border style="width: 100%" height="350px"> |
| | | <el-table-column type="index" label="序号" width="70" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="区间" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-input size="small" v-model="scope.row.thing" clearable></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="70" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" type="danger" icon="el-icon-minus" circle @click="sectionList.splice(scope.$index, 1)"></el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="sectionUpDia = false">取 消</el-button> |
| | | <el-button type="primary" @click="sectionLoadAdd" :loading="sectionLoad">保 存</el-button> |
| | | <el-button type="primary" @click="sectionList.push({thing: ''})" icon="el-icon-plus"></el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | selectField: {}, |
| | | }, |
| | | expandedKeys: [], |
| | | filters: [] |
| | | filters: [], |
| | | sectionUpDia: false, |
| | | sectionLoad: false, |
| | | sectionRow: null, |
| | | sectionList: [] |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | }, |
| | | deleteStandard(arr, label) { |
| | | arr.forEach((item, index) => { |
| | | if(item.label == label){ |
| | | if (item.label == label) { |
| | | arr.splice(index, 1); |
| | | }else{ |
| | | item.children&&this.deleteStandard(item.children, label); |
| | | } else { |
| | | item.children && this.deleteStandard(item.children, label); |
| | | } |
| | | }) |
| | | }, |
| | |
| | | category: "子实验室" |
| | | }).then(res => { |
| | | this.factory = [] |
| | | res.data.forEach(a=>{ |
| | | res.data.forEach(a => { |
| | | this.filters.push({ |
| | | text: a.label, |
| | | value: a.value |
| | |
| | | this.$message.success('添加成功') |
| | | this.addDia = false |
| | | this.list |
| | | .find(a => a.label == this.addOb.factory).children |
| | | .find(a => a.label == this.addOb.laboratory).children |
| | | .find(a => a.label == this.addOb.sampleType).children |
| | | .find(a => a.label == this.addOb.sample).children.push({ |
| | | code:'[5]', |
| | | label: this.addOb.model, |
| | | value: this.addOb.model, |
| | | }) |
| | | .find(a => a.label == this.addOb.factory).children |
| | | .find(a => a.label == this.addOb.laboratory).children |
| | | .find(a => a.label == this.addOb.sampleType).children |
| | | .find(a => a.label == this.addOb.sample).children.push({ |
| | | code: '[5]', |
| | | label: this.addOb.model, |
| | | value: this.addOb.model, |
| | | }) |
| | | this.addLoad = false |
| | | }).catch(e => { |
| | | this.addDia = false |
| | |
| | | return m |
| | | }) |
| | | } |
| | | }, |
| | | sectionUp(row) { |
| | | this.sectionRow = row |
| | | this.sectionUpDia = true |
| | | this.sectionList = [] |
| | | if(this.sectionRow.section!==null){ |
| | | JSON.parse(this.sectionRow.section).forEach(a=>{ |
| | | this.sectionList.push({ |
| | | thing: a |
| | | }) |
| | | }) |
| | | } |
| | | }, |
| | | sectionLoadAdd() { |
| | | let sectionList = [] |
| | | this.sectionList.forEach(a=>{ |
| | | if(a.thing!==''){ |
| | | sectionList.push(a.thing) |
| | | } |
| | | }) |
| | | this.sectionRow.section = JSON.stringify(sectionList) |
| | | this.sectionLoad = true |
| | | this.$axios.post(this.$api.standardTree.upStandardProductList, { |
| | | id: this.sectionRow.id, |
| | | section: this.sectionRow.section |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | this.sectionLoad = false |
| | | if (res.code == 201) { |
| | | this.$message.error('未保存') |
| | | return |
| | | } |
| | | this.$message.success('已保存') |
| | | this.sectionUpDia = false |
| | | }) |
| | | } |
| | | } |
| | | } |
| | |
| | | padding: 20px; |
| | | } |
| | | </style> |
| | | <style> |
| | | .el-upload--text{ |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | | <div class="person_manage"> |
| | |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | row: 2, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: false, |
| | |
| | | select: [] |
| | | } |
| | | }, |
| | | cascaderField:{ |
| | | /* cascaderField:{ |
| | | departId:{ |
| | | tree:[] |
| | | }, |
| | |
| | | label:'name', |
| | | checkStrictly: true |
| | | } |
| | | }, |
| | | requiredAdd:['account','name','state','roleId','password','departId'], |
| | | requiredUp:['account','name','state','roleId','departId'], |
| | | }, */ |
| | | requiredAdd:['account','name','state','roleId','password'], |
| | | requiredUp:['account','name','state','roleId'], |
| | | addUpload:['pictureUrl','signatureUrl'], |
| | | addUploadConfig:{ |
| | | accept:'.png, .jpg, .jpeg, .gif', |
| | |
| | | this.$refs.ValueTable.openAddDia(this.$api.user.addUser); |
| | | }, |
| | | selectTreeList(){ |
| | | this.$axios.get(this.$api.department.selectDepartment).then(res => { |
| | | /* this.$axios.get(this.$api.department.selectDepartment).then(res => { |
| | | this.componentData.cascaderField.departId.tree = this.handleTree(res.data[0].children) |
| | | this.$refs.ValueTable.selectList() |
| | | }) |
| | | }) */ |
| | | this.$refs.ValueTable.selectList() |
| | | }, |
| | | handleTree(arr){ |
| | | arr.forEach(a => { |
| | |
| | | <style scoped> |
| | | .title { |
| | | height: 60px; |
| | | line-height: 60px; |
| | | } |
| | | .title { |
| | | height: 60px; |
| | | line-height: 60px; |
| | | } |
| | | |
| | | .search { |
| | | background-color: #fff; |
| | | height: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .search { |
| | | background-color: #fff; |
| | | height: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .search_thing { |
| | | width: 350px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .search_thing { |
| | | width: 350px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .search_label { |
| | | width: 110px; |
| | | font-size: 14px; |
| | | text-align: right; |
| | | } |
| | | .search_label { |
| | | width: 110px; |
| | | font-size: 14px; |
| | | text-align: right; |
| | | } |
| | | |
| | | .search_input { |
| | | width: calc(100% - 110px); |
| | | } |
| | | .search_input { |
| | | width: calc(100% - 110px); |
| | | } |
| | | |
| | | .table { |
| | | margin-top: 10px; |
| | | background-color: #fff; |
| | | width: calc(100% - 40px); |
| | | height: calc(100% - 60px - 80px - 10px - 40px); |
| | | padding: 20px; |
| | | } |
| | | .table { |
| | | margin-top: 10px; |
| | | background-color: #fff; |
| | | width: calc(100% - 40px); |
| | | height: calc(100% - 60px - 80px - 10px - 40px); |
| | | padding: 20px; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | | <div class="role_manage"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="padding-left: 20px;">角色管理</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增角色</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="search"> |
| | | <div class="search_thing"> |
| | | <div class="search_label">角色名称:</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.name" |
| | | @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing" style="padding-left: 30px;"> |
| | | <el-button size="small" @click="refresh()">重 置</el-button> |
| | | <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <ValueTable ref="ValueTable" :url="$api.user.selectRoleLists" :delUrl="$api.user.delRole" |
| | | :componentData="componentData" :key="upIndex" @upRole="upRole" @selectRole="selectRole" /> |
| | | </div> |
| | | <el-dialog :title="type" :visible.sync="addDia" width="500px" @closed="closed"> |
| | | <div style="max-height: 500px;overflow-y: auto;padding: 8px;" v-if="addDia"> |
| | | <el-row style="line-height: 40px;margin-bottom: 15px;"> |
| | | <el-col :span="8"><span class="required-span">* </span>角色名</el-col> |
| | | <el-col :span="16"> |
| | | <el-input v-model="addData.roleName" size="medium" placeholder="需唯一角色名" clearable :disabled="type=='查看'"></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider content-position="left">权限分配</el-divider> |
| | | <el-collapse style="margin-top: 10px;"> |
| | | <el-collapse-item title="查询"> |
| | | <div class="role_manage"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="padding-left: 20px;">角色管理</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增角色</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="search"> |
| | | <div class="search_thing"> |
| | | <div class="search_label">角色名称:</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.name" |
| | | @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing" style="padding-left: 30px;"> |
| | | <el-button size="small" @click="refresh()">重 置</el-button> |
| | | <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <ValueTable ref="ValueTable" :url="$api.user.selectRoleLists" :delUrl="$api.user.delRole" |
| | | :componentData="componentData" :key="upIndex" @upRole="upRole" @selectRole="selectRole" /> |
| | | </div> |
| | | <el-dialog :title="type" :visible.sync="addDia" width="550px" @closed="closed"> |
| | | <div style="max-height: 500px;overflow-y: auto;padding: 10px;" v-if="addDia"> |
| | | <el-row style="line-height: 40px;margin-bottom: 20px;"> |
| | | <el-col :span="8" style="font-size: 16px;"><span class="required-span">* </span>角色名</el-col> |
| | | <el-col :span="16"> |
| | | <el-input v-model="addData.roleName" size="medium" placeholder="需唯一角色名" clearable |
| | | :disabled="type=='查看'"></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider content-position="left">权限分配</el-divider> |
| | | <el-collapse style="margin-top: 10px;padding: 0 10px;"> |
| | | <el-collapse-item v-for="(category, ci) in menuCategroy" :key="ci"> |
| | | <template slot="title"> |
| | | <i class="el-icon-circle-plus-outline" style="margin-right: 10px;"></i>{{category}} |
| | | </template> |
| | | <div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type==category"><el-checkbox |
| | | v-model="a.isClick" :disabled="type=='查看'">{{a.remark}}</el-checkbox></div> |
| | | </el-collapse-item> |
| | | <!-- <el-collapse-item title="查询"> |
| | | <el-row style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='查询'"> |
| | | <el-col :span="18"> |
| | | <el-checkbox :disabled="type=='查看'" v-model="a.isClick">{{a.remark}}</el-checkbox> |
| | |
| | | <el-checkbox :disabled="type=='查看'" v-model="a.look">只看我</el-checkbox> |
| | | </el-col> |
| | | </el-row> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="添加"> |
| | | <div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='添加'"><el-checkbox |
| | | v-model="a.isClick" :disabled="type=='查看'">{{a.remark}}</el-checkbox></div> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="修改"> |
| | | <div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='修改'"><el-checkbox |
| | | v-model="a.isClick" :disabled="type=='查看'">{{a.remark}}</el-checkbox></div> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="删除"> |
| | | <div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='删除'"><el-checkbox |
| | | v-model="a.isClick" :disabled="type=='查看'">{{a.remark}}</el-checkbox></div> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="导入"> |
| | | <div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='导入'"><el-checkbox |
| | | v-model="a.isClick" :disabled="type=='查看'">{{a.remark}}</el-checkbox></div> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="导出"> |
| | | <div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='导出'"><el-checkbox |
| | | v-model="a.isClick" :disabled="type=='查看'">{{a.remark}}</el-checkbox></div> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="addDia = false">取 消</el-button> |
| | | <el-button type="primary" @click="saveAddData" :loading="addLoad" v-if="type!='查看'">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </el-collapse-item> --> |
| | | </el-collapse> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="addDia = false">取 消</el-button> |
| | | <el-button type="primary" @click="saveAddData" :loading="addLoad" v-if="type!='查看'">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ValueTable from '../tool/value-table.vue' |
| | | export default { |
| | | components: { |
| | | ValueTable |
| | | }, |
| | | data() { |
| | | return { |
| | | componentData: { |
| | | entity: { |
| | | name: null, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | showSelect: false, |
| | | select: true, |
| | | isIndex: true, |
| | | do: [{ |
| | | font: '编辑', |
| | | type: 'text', |
| | | method: 'upRole', |
| | | field: [] |
| | | }, { |
| | | id: 'delete', |
| | | font: '删除', |
| | | type: 'text', |
| | | method: 'doDiy', |
| | | }, { |
| | | font: '查看', |
| | | type: 'text', |
| | | method: 'selectRole', |
| | | }], |
| | | tagField: {}, |
| | | selectField: {} |
| | | }, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | addDia: false, |
| | | addLoad: false, |
| | | addData: { |
| | | roleId2: null, |
| | | roleName: null, |
| | | powers: [] |
| | | }, |
| | | menu: [], |
| | | menuCopy: [], |
| | | type: '新增', |
| | | addPower: true |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.entityCopy = this.HaveJson(this.componentData.entity) |
| | | this.selectMenuList() |
| | | this.getPower() |
| | | }, |
| | | methods: { |
| | | refreshTable() { |
| | | this.$refs['ValueTable'].selectList() |
| | | }, |
| | | refresh() { |
| | | this.componentData.entity = this.HaveJson(this.entityCopy) |
| | | this.upIndex++ |
| | | }, |
| | | selectMenuList() { |
| | | this.$axios.get(this.$api.user.selectMenuList).then(res => { |
| | | res.data.forEach(a => { |
| | | a.isClick = false |
| | | a.look = false |
| | | }) |
| | | this.menu = res.data |
| | | this.menuCopy = this.HaveJson(res.data) |
| | | }) |
| | | }, |
| | | upRole(row) { |
| | | this.type = '修改' |
| | | this.addData.roleName = row.name |
| | | this.selectPowerByRoleId(row.id) |
| | | }, |
| | | selectRole(row) { |
| | | this.type = '查看' |
| | | this.addData.roleName = row.name |
| | | this.selectPowerByRoleId(row.id) |
| | | }, |
| | | openAdd() { |
| | | this.type = '新增' |
| | | this.addDia = true |
| | | }, |
| | | saveAddData() { |
| | | if (this.addData.roleName == '' || this.addData.roleName == null) { |
| | | this.$message.error('请填写角色名') |
| | | return |
| | | } |
| | | this.addLoad = true |
| | | let url = '' |
| | | if (this.type == '新增') { |
| | | url = this.$api.user.addRole |
| | | } else { |
| | | url = this.$api.user.upRole |
| | | } |
| | | this.addData.powers = [] |
| | | this.menu.forEach(a => { |
| | | if (a.isClick) { |
| | | let str = 0 |
| | | if (a.look) { |
| | | str = 1 |
| | | } |
| | | this.addData.powers.push({ |
| | | menuMethod: a.method, |
| | | look: str |
| | | }) |
| | | } |
| | | }) |
| | | this.$axios.post(url, { |
| | | str: JSON.stringify(this.addData) |
| | | }).then(res => { |
| | | if(res.code == 201){ |
| | | if (this.type == '新增') { |
| | | this.$message.error('添加失败') |
| | | } else { |
| | | this.$message.error('修改失败') |
| | | } |
| | | this.addLoad = false |
| | | return |
| | | } |
| | | if (this.type == '新增') { |
| | | this.$message.success('添加成功') |
| | | } else { |
| | | this.$message.success('修改成功') |
| | | } |
| | | this.addLoad = false |
| | | this.addDia = false |
| | | this.refreshTable() |
| | | }).catch(e => { |
| | | this.addLoad = false |
| | | }) |
| | | }, |
| | | selectPowerByRoleId(id) { |
| | | this.$axios.post(this.$api.user.selectPowerByRoleId, { |
| | | id: id |
| | | }).then(res => { |
| | | res.data.forEach(a => { |
| | | this.menu.forEach(b => { |
| | | if (a.menuMethod == b.method) { |
| | | b.isClick = true |
| | | b.look = (a.look == 1 ? true : false) |
| | | } |
| | | }) |
| | | }) |
| | | this.addData.roleId2 = id |
| | | this.addDia = true |
| | | }) |
| | | }, |
| | | closed() { |
| | | this.addData = { |
| | | roleId2: null, |
| | | roleName: null, |
| | | powers: [] |
| | | } |
| | | this.menu = this.HaveJson(this.menuCopy) |
| | | }, |
| | | // 权限分配 |
| | | getPower(){ |
| | | let power = JSON.parse(sessionStorage.getItem('power')) |
| | | let up = false |
| | | let del = false |
| | | let add = false |
| | | for (var i = 0; i < power.length; i++) { |
| | | if(power[i].menuMethod=='upRole'){ |
| | | up = true |
| | | } |
| | | if(power[i].menuMethod=='delRole'){ |
| | | del = true |
| | | } |
| | | if(power[i].menuMethod=='addRole'){ |
| | | add = true |
| | | } |
| | | } |
| | | if(!del){ |
| | | this.componentData.do.splice(1, 1) |
| | | } |
| | | if(!up){ |
| | | this.componentData.do.splice(0, 1) |
| | | } |
| | | this.addPower = add |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | import { |
| | | set |
| | | } from 'vue' |
| | | import ValueTable from '../tool/value-table.vue' |
| | | export default { |
| | | components: { |
| | | ValueTable |
| | | }, |
| | | data() { |
| | | return { |
| | | componentData: { |
| | | entity: { |
| | | name: null, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | showSelect: false, |
| | | select: true, |
| | | isIndex: true, |
| | | do: [{ |
| | | font: '编辑', |
| | | type: 'text', |
| | | method: 'upRole', |
| | | field: [] |
| | | }, { |
| | | id: 'delete', |
| | | font: '删除', |
| | | type: 'text', |
| | | method: 'doDiy', |
| | | }, { |
| | | font: '查看', |
| | | type: 'text', |
| | | method: 'selectRole', |
| | | }], |
| | | tagField: {}, |
| | | selectField: {} |
| | | }, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | addDia: false, |
| | | addLoad: false, |
| | | addData: { |
| | | roleId2: null, |
| | | roleName: null, |
| | | powers: [] |
| | | }, |
| | | menu: [], |
| | | menuCategroy: [], |
| | | menuCopy: [], |
| | | type: '新增', |
| | | addPower: true |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.entityCopy = this.HaveJson(this.componentData.entity) |
| | | this.selectMenuList() |
| | | this.getPower() |
| | | }, |
| | | methods: { |
| | | refreshTable() { |
| | | this.$refs['ValueTable'].selectList() |
| | | }, |
| | | refresh() { |
| | | this.componentData.entity = this.HaveJson(this.entityCopy) |
| | | this.upIndex++ |
| | | }, |
| | | selectMenuList() { |
| | | this.$axios.get(this.$api.user.selectMenuList).then(res => { |
| | | res.data.forEach(a => { |
| | | a.isClick = false |
| | | a.look = false |
| | | }) |
| | | let set = new Set() |
| | | res.data.forEach(a => { |
| | | set.add(a.type) |
| | | }) |
| | | this.menuCategroy = set |
| | | this.menu = res.data |
| | | this.menuCopy = this.HaveJson(res.data) |
| | | }) |
| | | }, |
| | | upRole(row) { |
| | | this.type = '修改' |
| | | this.addData.roleName = row.name |
| | | this.selectPowerByRoleId(row.id) |
| | | }, |
| | | selectRole(row) { |
| | | this.type = '查看' |
| | | this.addData.roleName = row.name |
| | | this.selectPowerByRoleId(row.id) |
| | | }, |
| | | openAdd() { |
| | | this.type = '新增' |
| | | this.addDia = true |
| | | }, |
| | | saveAddData() { |
| | | if (this.addData.roleName == '' || this.addData.roleName == null) { |
| | | this.$message.error('请填写角色名') |
| | | return |
| | | } |
| | | this.addLoad = true |
| | | let url = '' |
| | | if (this.type == '新增') { |
| | | url = this.$api.user.addRole |
| | | } else { |
| | | url = this.$api.user.upRole |
| | | } |
| | | this.addData.powers = [] |
| | | this.menu.forEach(a => { |
| | | if (a.isClick) { |
| | | let str = 0 |
| | | if (a.look) { |
| | | str = 1 |
| | | } |
| | | this.addData.powers.push({ |
| | | menuMethod: a.method, |
| | | look: str |
| | | }) |
| | | } |
| | | }) |
| | | this.$axios.post(url, { |
| | | str: JSON.stringify(this.addData) |
| | | }).then(res => { |
| | | if (res.code == 201) { |
| | | if (this.type == '新增') { |
| | | this.$message.error('添加失败') |
| | | } else { |
| | | this.$message.error('修改失败') |
| | | } |
| | | this.addLoad = false |
| | | return |
| | | } |
| | | if (this.type == '新增') { |
| | | this.$message.success('添加成功') |
| | | } else { |
| | | this.$message.success('修改成功') |
| | | } |
| | | this.addLoad = false |
| | | this.addDia = false |
| | | this.refreshTable() |
| | | }).catch(e => { |
| | | this.addLoad = false |
| | | }) |
| | | }, |
| | | selectPowerByRoleId(id) { |
| | | this.$axios.post(this.$api.user.selectPowerByRoleId, { |
| | | id: id |
| | | }).then(res => { |
| | | res.data.forEach(a => { |
| | | this.menu.forEach(b => { |
| | | if (a.menuMethod == b.method) { |
| | | b.isClick = true |
| | | b.look = (a.look == 1 ? true : false) |
| | | } |
| | | }) |
| | | }) |
| | | this.addData.roleId2 = id |
| | | this.addDia = true |
| | | }) |
| | | }, |
| | | closed() { |
| | | this.addData = { |
| | | roleId2: null, |
| | | roleName: null, |
| | | powers: [] |
| | | } |
| | | this.menu = this.HaveJson(this.menuCopy) |
| | | }, |
| | | // 权限分配 |
| | | getPower() { |
| | | let power = JSON.parse(sessionStorage.getItem('power')) |
| | | let up = false |
| | | let del = false |
| | | let add = false |
| | | for (var i = 0; i < power.length; i++) { |
| | | if (power[i].menuMethod == 'upRole') { |
| | | up = true |
| | | } |
| | | if (power[i].menuMethod == 'delRole') { |
| | | del = true |
| | | } |
| | | if (power[i].menuMethod == 'addRole') { |
| | | add = true |
| | | } |
| | | } |
| | | if (!del) { |
| | | this.componentData.do.splice(1, 1) |
| | | } |
| | | if (!up) { |
| | | this.componentData.do.splice(0, 1) |
| | | } |
| | | this.addPower = add |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | // const javaApi = 'http://192.168.11.249:8001';//张 |
| | | const javaApi = 'http://172.20.10.3:8001';//姜 |
| | | // const javaApi = 'http://192.168.11.2:8001';//柴 |
| | | // const javaApi = 'http://114.132.189.42:9006';//测试服 |
| | | // const javaApi = 'http://114.132.189.42:1234';//测试服 |
| | | //胜云服务器 |
| | | // Vue.prototype.LOCATIONVUE = "http://syxt.shxiao2.cn"; |
| | | // const javaApi = 'http://122.114.52.69:8001'; |
| | | //云服务器 |
| | | // Vue.prototype.LOCATIONVUE = "http://114.132.189.42:39901"; |
| | | // const javaApi = 'http://114.132.189.42:9006'; |
| | | |
| | | Vue.prototype.HaveJson = (val) => { |
| | | return JSON.parse(JSON.stringify(val)) |