123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <template>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList">返回列表
- </el-button>
- <div class="upper_right_button">
- <el-button class="el-button--small-yh"
- type="primary"
- size="small"
- :loading="buttonLoading"
- @click.stop="saveData"
- >保存数据
- </el-button>
- </div>
- </div>
- </div>
- <div class="customer-main">
- <containerTitle title="基础信息"></containerTitle>
- <basic-container>
- <avue-form class="trading-form" ref="form" v-model="form" :option="option">
- <template slot="remark">
- <el-input type="textarea"
- v-model="form.remark"
- size="small"
- rows="2"
- autocomplete="off"
- placeholder="">
- </el-input>
- </template>
- </avue-form>
- </basic-container>
- <containerTitle title="明细列表"></containerTitle>
- <basic-container>
- <avue-crud :option="itemsOption"
- :data="dataList"
- ref="crud"
- v-model="itemsForm"
- @search-reset="searchReset"
- @row-update="rowUpdate"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange">
- <template slot="menuLeft">
- <el-button type="primary"
- size="small"
- :loading="buttonLoading"
- @click="addDetail"
- >录入明细
- </el-button>
- </template>
- <template slot-scope="scope" slot="menu">
- <el-button
- type="text"
- size="small"
- icon="el-icon-edit"
- @click.stop="rowCell(scope.row,scope.index)"
- > {{ scope.row.$cellEdit ? '修改完成' : '修改' }}
- </el-button>
- <el-button
- type="text"
- size="small"
- icon="el-icon-delete"
- @click.stop="rowDel(scope.row,scope.index)"
- >删除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- </div>
- </div>
- </template>
- <script>
- import option from "./config/detailsPage.json";
- import { contrastObj,contrastList } from "@/util/contrastData";
- import {appSave ,appDetail,appDetailRemove} from "@/api/application/application";
- export default {
- name: "receiptDetailsPage",
- props: {
- detailData: {
- type: Object
- }
- },
- components:{
- },
- data() {
- return {
- buttonLoading:false,
- form: {},
- itemsForm:{},
- dataList: [],
- itemsOption: option,
- option: {
- menuBtn: false,
- labelWidth: 100,
- column: [
- {
- label: 'app名称',
- prop: 'appName',
- span: 8,
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },{
- label: '应用描述',
- prop: 'appDesc',
- span: 8,
- },
- {
- label: '类型',
- prop: 'type',
- type:'select',
- dicData:[{
- label:'安卓',
- value:0,
- },
- {
- label:'苹果',
- value:1,
- }],
- span: 8,
- },
- {
- label: '苹果appStoreId',
- prop: 'appStoreId',
- span: 8,
- },
- {
- label: '苹果bundleId',
- prop: 'bundleId',
- span: 8,
- },
- {
- label: '安卓包名',
- prop: 'packageName',
- span: 8,
- },
- ],
- },
- oldForm:{},
- oldDataList:[],
- }
- },
- created() {
- if(this.detailData.id){
- this.buttonLoading = true
- appDetail(this.detailData.id).then(res=>{
- this.afterEcho(res.data.data)
- }).finally(()=>{
- this.buttonLoading = false
- })
- }
- },
- mounted() {
- },
- methods: {
- rowUpdate(row, index, done) {
- done(row);
- },
- rowCell(row,index){
- this.$refs.crud.rowCell(row, index)
- },
- rowDel(row,index){
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if(row.id){
- appDetailRemove(row.id).then(res=>{
- if(res.data.success){
- this.$message.success("操作成功!")
- this.dataList.splice(index, 1);
- }
- })
- }else{
- this.dataList.splice(index, 1);
- }
- })
- },
- addDetail(){
- this.$refs.crud.rowCellAdd();
- },
- searchReset() {
- console.log('1')
- },
- selectionChange() {
- console.log('1')
- },
- currentChange() {
- console.log('1')
- },
- sizeChange() {
- console.log('1')
- },
- refreshChange() {
- console.log('1')
- },
- saveData(type){
- this.buttonLoading = true
- let params = {
- ...this.form,
- appVersionList: this.dataList
- }
- appSave(params).then(res =>{
- if(res.data.success){
- this.$message.success("操作成功!")
- this.afterEcho(res.data.data)
- }
- }).finally(()=>{
- this.buttonLoading = false
- if(type === true){
- this.$emit("goBack");
- }
- })
- },
- afterEcho(data){
- this.form = data
- this.oldForm = Object.assign({},data);
- if(data.appVersionList){
- this.dataList = data.appVersionList
- this.oldDataList = this.deepClone(data.appVersionList)
- }
- },
- verificationData(){
- if(contrastObj(this.form,this.oldForm) || contrastList(this.dataList,this.oldDataList)
- ){
- this.$confirm("数据发生变化,请先提交保存!", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.saveData()
- }).catch(()=>{
- return false
- })
- }else{
- return true
- }
- },
- backToList(){
- if(contrastObj(this.form,this.oldForm) || contrastList(this.dataList,this.oldDataList)
- ){
- this.$confirm("是否保存当前页面?", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.saveData(true)
- }).catch(()=>{
- this.$emit("goBack");
- })
- }else{
- this.$emit("goBack");
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- .trading-form ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- .required_fields{
- color: #F56C6C;
- display:inline-block;
- width: 7%
- }
- .upper_right_button{
- display: flex;
- position: fixed;
- right: 12px;
- top: 47px;
- }
- </style>
|