zuozhengqing
2024-04-11 763762fca04a6dcf391f75e9541fe7287f6b0ed1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<template>
  <div class="silkStandardSetting-container">
    <div class="filter-card">
      <CommonSearch ref="searchRef" :show-add="false" :amount-view="false" placeholder="请输入关键词" @searchClick="onFilterSearch">
        <template slot="leftButton">
          <el-button size="small" type="primary" @click="addBtnClick" >新增</el-button>
          <el-button size="small" type="primary" @click="refreshClick">刷新</el-button>
          <el-button size="small" type="primary" @click="printClick">打印</el-button>
        </template>
      </CommonSearch>
    </div>
    <div class="body-card">
      <div  class="list-view">
        <TableCommonView
          :table-list="tableList"
          @selTableCol="selTableCol"
          @tableRowClick="tableRowClick"
        >
          <template slot="tableButton">
            <el-table-column label="操作" width="180">
              <template slot-scope="scope">
                <el-button @click.stop="handleClick(scope.row, '查看')" type="text" size="small">查看</el-button>
                <el-button @click.stop="handleClick(scope.row, '修改')" type="text" size="small">修改</el-button>
                <el-button @click.stop="handleClick(scope.row, '删除')" type="text" size="small">删除</el-button>
                
              </template>
            </el-table-column>
          </template>
        </TableCommonView>
      </div>
      <div class="btn-pager">
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
      </div>
    </div>
    
    <AddDialog 
      :editDiaConfig="editConfig"
    />
  </div>
</template>
 
<script>
import AddDialog from "@/views/systemSetting/silkPriceStandard/components/addDialog"
import {getPriceStandardList,deletePriceStandard} from "@/api/systemSetting/silkPriceStandard"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "silkPriceStandard",
  props: {},
  components: { AddDialog },
  mixins: [pageMixin],
  computed: {},
  data() {
    return {
      tableList: {},
      showCol: ["庄口", "生丝等级", "薪酬标准", "单位", "备注"],
      tableColumn: [
        { label: "庄口", prop: "marketName",},
        { label: "生丝等级", prop: "rawSilkGrade", },
        { label: "薪酬标准", prop: "payStandard" },
        { label: "单位", prop: "unit" },
        { label: "备注", prop: "notes", },
      ],
      editConfig:{
        visible:false,
        infomitton:{
 
        }
      },
      getDataParams:{
        keyWord:"",
        // page: this.pagerOptions.currPage,
        // pageSize: this.pagerOptions.pageSize
      }
    }
  },
  created() {
    this.setTable()
    this.getData()
  },
  methods: {
    // 搜索
    onFilterSearch(searchText) {
      this.getDataParams.keyWord = searchText
      this.pagerOptions.currPage = 1
      this.getData()
    },
    // 新增
    addBtnClick() {
      this.editConfig.infomitton={}
      this.editConfig.dialogTitle="新增"
      this.editConfig.visible=true
    },
    // 保存
    saveBtnClick(){
    },
    // 刷新
    refreshClick() {
      this.getDataParams.keyWord = ""
      this.pagerOptions.currPage = 1
      this.pagerOptions.pageSize = 15
      this.$refs.searchRef.searchInput=""
      this.getData()
 
    },
    // 打印
    printClick() {},
    // 列表输入回调
    inputContent(val, prop, row) {
      console.log(val, prop, row,"列表打印回调")
    },
    setTable() {
      // top 明细单列表
      this.tableList = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showCol,
        tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
      }
      this.setTableList(this.tableList)
    },
    setColumnVisible(showCol, tableColumn) {
      return tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
    setTableList(tableList) {
      tableList.allcol = tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
      this.searchOptions = []
      for (let i = 0; i < tableList.tableColumn.length; i++) {
        const label = tableList.tableColumn[i].label
        const value = tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    selTableCol(val) {
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
    },
    // 表格行点击
    tableRowClick(row){
      console.log(row,"row")
    },
    async getData(){
      await getPriceStandardList({
        keyWord:this.getDataParams.keyWord,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      }).then((res)=>{
        if(res&&res.code===200){
          this.tableList.tableInfomation=res.data
          this.pagerOptions.totalCount = res.total
        }
      })
    },
    handleClick(row,type){
      if(type!=="删除"){
        this.editConfig.infomitton={
            ...row,
            market:{
            ID:row.marketId,
            name:row.marketName,
          }
        }
        this.editConfig.dialogTitle=type
        this.editConfig.visible=true
      }else if(type==="删除"){
        this.$confirm(`确认删除吗?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deletePriceStandard({id:row.ID}).then((res)=>{
            if(res&&res.code===200){
              this.getData()
              this.$message({
                type: 'success',
                message: '删除成功!'
              });
            }
          })
        }).catch(() => {
          console.log("取消删除")
        });
      }
    }
  }
}
</script>
 
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.silkStandardSetting-container {
  height: 100%;
  .filter-card {
    margin: 20px 30px;
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 20px 0 20px;
    border-radius: 4px;
    background-color: #fff;
  }
  .body-card {
    margin: 0 30px;
    background-color: #fff;
    padding: 10px 15px;
    height: calc(100% - 180px);
    border-radius: 4px;
    .edit-save {
      display: flex;
      align-items: center;
      margin-bottom: 10px;
      .edit-save-icon {
        font-size: 24px;
        color: #5582f3;
        cursor: pointer;
      }
      .edit-sace-label {
        margin-left: 10px;
        font-size: 14px;
        color: #000000d8;
      }
    }
  }
}
.list-view {
  height: calc(100% - 60px);
  overflow: hidden;
}
.btn-pager {
  display: flex;
  margin-top: 10px;
  .page {
    margin-left: auto;
  }
}
</style>