123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template>
- <div>
- <div style="display:flex;align-items:center">
- <el-input
- :placeholder="$t('请输入搜索内容')"
- suffix-icon="el-icon-search"
- v-model="params.content.where.condition"
- style="width:200px"
- size="mini"
- class="input-with-select inline-16"
- @keyup.native.enter="listData(params.content.pageNumber=1)"
- @clear="clearData"
- clearable>
- </el-input>
- <slot name="addProduct"></slot>
- </div>
- <div style="margin-top: 15px">
- <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true" :width="false" :height="tableHieght" fixedName="operation">
- <template v-slot:customcol="scope">
- <div v-if="scope.column.columnname == 'reason'">
- <div v-if="currentProduct.sa_serviceorderitemsid == scope.column.data.sa_serviceorderitemsid">
- <el-input type="textarea" size="mini" v-model="scope.column.data.reason"></el-input>
- </div>
- <div v-else>{{scope.column.data.reason ? scope.column.data.reason : '--'}}</div>
- </div>
- <div v-else-if="scope.column.columnname === 'nominalpressure'">
- {{tool.nominalPressureSet(scope.column.data.nominalpressure)}}
- </div>
- <div v-else-if="scope.column.columnname == 'itemno'">
- {{scope.column.data[scope.column.columnname]}}
- <div v-if="siteid == 'HY' && scope.column.data.traceabilitytype && scope.column.data.traceabilitytype.length > 0">
- <div v-for="item in scope.column.data.traceabilitytype" :key="item.index">
- <el-tag v-if="item == 'M'" style="margin-left: 5px;color: #FFFFFF;background-color: #3874F6" size="mini">{{$t('自制')}}</el-tag>
- <el-tag v-else style="margin-left: 5px;color: #FFFFFF;background-color: #fa8c16" size="mini">{{$t('外购')}}</el-tag>
- </div>
- </div>
- </div>
- <p v-else>{{scope.column.data[scope.column.columnname] || scope.column.columnname == 'operation'?$t(scope.column.data[scope.column.columnname]):'--'}}</p>
- </template>
- <template v-slot:opreation="scope">
- <el-button class="inline-16" type="text" size="mini" @click="save(scope.data)" v-if="currentProduct.sa_serviceorderitemsid == scope.data.sa_serviceorderitemsid">{{$t('保 存')}}</el-button>
- <slot v-else name="editProduct" :data="scope.data"></slot>
- <slot name="delProduct" :data="scope.data"></slot>
- </template>
- </tableLayout>
- </div>
- <div style="margin-top:16px;text-align:right">
- <el-pagination
- background
- small
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="params.content.pageNumber"
- :page-size="params.content.pageSize"
- layout="total, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </template>
- <script>
- export default {
- props:["data"],
- data () {
- return {
- tableHieght:"calc(100vh - 380px)",
- tablecols:[],
- list:[],
- total:0,
- params:{
- "id": 20230206161903,
- "version":1,
- "content": {
- "sa_serviceorderid":'',
- "pageNumber":1,
- "pageSize":20,
- "where":{
- "condition":''
- }
- }
- },
- options:[
- ],
- productList:'',
- currentProduct:{},
- siteid:JSON.parse(sessionStorage.getItem('active_account')).siteid
- }
- },
- methods:{
- async save (data) {
- let res = await this.$api.requested({
- "id": "20230206161803",
- "version":1,
- "content": {
- "sa_serviceorderid":this.$route.query.id,
- "iteminfos":[
- {
- "sa_serviceorderitemsid": data.sa_serviceorderitemsid,
- "itemid": data.itemid,
- "qty":data.qty,
- "reason": data.reason
- }
- ]
- }
- })
- this.tool.showMessage(res,() => {
- this.$emit('onSuccess')
- this.listData()
- this.currentProduct = ''
- })
- },
- async listData(){
- this.params.content.sa_serviceorderid = this.$route.query.id
- const res = await this.$api.requested(this.params)
- this.list = res.data
- this.total = res.total
- console.log(this.list)
- },
- handleSizeChange(val) {
- // console.log(`每页 ${val} 条`);
- this.params.content.pageSize = val
- this.listData()
- },
- handleCurrentChange(val) {
- // console.log(`当前页: ${val}`);
- this.params.content.pageNumber = val
- this.listData()
- },
- clearData(){
- this.listData()
- },
- queryClick(){
- this.listData()
- }
- },
- mounted() {
- this.listData()
- },
- created() {
- this.tablecols = this.tool.tabelCol(this.$route.name).productTable.tablecols
- }
- }
- </script>
- <style scoped>
- </style>
|