lixiangyu
昨天 1be1ed62ae14b87f64b82cdc4a6b2b002e5ababc
src/views/cms/CuttingScrapList.vue
@@ -7,22 +7,22 @@
          <a-col :md="6" :sm="8">
            <a-form-item label="报废单状态">
              <j-search-select-tag
                  placeholder="请选择报废单状态"
                  v-model="queryParam.orderStatus"
                  dict="order_status"
                />
                placeholder="请选择报废单状态"
                v-model="queryParam.orderStatus"
                dict="order_status"
              />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
              <a-form-item label="申请人">
                <j-search-select-tag
                  placeholder="请选择申请人"
                  v-model="queryParam.applicant"
                  dict="sys_user,realname,id,del_flag!=1"
                />
              </a-form-item>
            </a-col>
            <a-col
            <a-form-item label="申请人">
              <j-search-select-tag
                placeholder="请选择申请人"
                v-model="queryParam.applicant"
                dict="sys_user,realname,id,del_flag!=1"
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="6"
            :sm="8"
          >
@@ -60,7 +60,8 @@
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
        style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
@@ -83,7 +84,8 @@
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
               style="max-width:80px;font-size: 12px;font-style: italic;" />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
@@ -108,7 +110,18 @@
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
              <a-menu-item v-if="record.orderStatus != '2'">
                  <a @click="handleSubmit(record.id)" :disabled="record.orderStatus == '3'">提交</a>
              </a-menu-item>
<!--              <a-menu-item>-->
<!--                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
<!--                  <a>删除</a>-->
<!--                </a-popconfirm>-->
<!--              </a-menu-item>-->
              <a-menu-item v-if="record.orderStatus === '1'">
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
@@ -119,7 +132,7 @@
      </a-table>
    </div>
<a-tabs defaultActiveKey="1">
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="刀具报废明细" key="1">
        <cutting-scrap-detail-list ref="cuttingScrapDetailList"></cutting-scrap-detail-list>
      </a-tab-pane>
@@ -130,126 +143,181 @@
<script>
  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import CuttingScrapModal from './modules/CuttingScrapModal'
  import CuttingScrapDetailList from './CuttingScrapDetailList'
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CuttingScrapModal from './modules/CuttingScrapModal'
import CuttingScrapDetailList from './CuttingScrapDetailList'
import { httpAction } from '@api/manage'
  export default {
    name: 'CuttingScrapList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      CuttingScrapModal,
      CuttingScrapDetailList
    },
    data () {
      return {
        description: '刀具报废管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'申请人',
            align:"center",
            dataIndex: 'applicant_dictText'
          },
          {
            title:'申请时间',
            align:"center",
            dataIndex: 'applicationTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'申请说明',
            align:"center",
            dataIndex: 'applicationComment'
          },
          {
            title:'确认人',
            align:"center",
            dataIndex: 'confirmer_dictText'
          },
          {
            title:'确认时间',
            align:"center",
            dataIndex: 'confirmTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'确认意见',
            align:"center",
            dataIndex: 'confirmComment'
          },
           {
            title:'报废单状态',
            align:"center",
            dataIndex: 'orderStatus'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
export default {
  name: 'CuttingScrapList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    CuttingScrapModal,
    CuttingScrapDetailList
  },
  data() {
    return {
      description: '刀具报废管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        ],
        url: {
          list: "/cms/cuttingScrap/list",
          delete: "/cms/cuttingScrap/delete",
          deleteBatch: "/cms/cuttingScrap/deleteBatch",
          exportXlsUrl: "/cms/cuttingScrap/exportXls",
          importExcelUrl: "cms/cuttingScrap/importExcel",
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
        {
          title: '申请人',
          align: 'center',
          dataIndex: 'applicant_dictText'
        },
        {
          title: '申请时间',
          align: 'center',
          dataIndex: 'applicationTime',
          customRender: function(text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '申请说明',
          align: 'center',
          dataIndex: 'applicationComment'
        },
        {
          title: '确认人',
          align: 'center',
          dataIndex: 'confirmer_dictText'
        },
        {
          title: '确认时间',
          align: 'center',
          dataIndex: 'confirmTime',
          customRender: function(text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '确认意见',
          align: 'center',
          dataIndex: 'confirmComment'
        },
        {
          title: '报废单状态',
          align: 'center',
          dataIndex: 'orderStatus_dictText'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/cms/cuttingScrap/list',
        delete: '/cms/cuttingScrap/delete',
        deleteBatch: '/cms/cuttingScrap/deleteBatch',
        exportXlsUrl: '/cms/cuttingScrap/exportXls',
        importExcelUrl: 'cms/cuttingScrap/importExcel',
        submit: '/cms/cuttingScrap/submit',
      },
    },
    methods: {
     searchReset() {
      dictOptions: {},
      superFieldList: []
    }
  },
  created() {
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    searchReset() {
      this.queryParam = {}
      this.$refs.cuttingScrapDetailList.dataSource = []
      this.loadData(1);
      this.loadData(1)
    },
      handleEdit: function (record) {
        this.$refs.modalForm.edit(record)
        this.$refs.modalForm.title = '编辑'
        this.$refs.modalForm.disableSubmit = false
    handleEdit: function(record) {
      this.$refs.modalForm.edit(record)
      this.$refs.modalForm.title = '编辑'
      this.$refs.modalForm.disableSubmit = false
    },
    handleAdd() {
      this.$refs.modalForm.add()
      this.$refs.modalForm.title = '新增'
      this.$refs.modalForm.disableSubmit = false
    },
    handleDetail:function(record){
      this.$refs.modalForm.edit(record);
      this.$refs.modalForm.title="详情";
      this.$refs.modalForm.disableSubmit = true;
    handleDetail: function(record) {
      this.$refs.modalForm.edit(record)
      this.$refs.modalForm.title = '详情'
      this.$refs.modalForm.disableSubmit = true
    },
     customRow(record) {
    //  单据提交
    handleSubmit: function(id) {
      if (!this.url.submit) {
        this.$message.error('请设置url.submit属性!')
        return
      }
      let targetId = id // 从参数获取ID
      // 如果没有通过参数传递ID,则检查选中的记录
      if (!targetId) {
        if (this.selectedRowKeys.length != 1) {
          this.$message.warning('请选择一条记录!')
          return
        } else {
          targetId = this.selectedRowKeys[0]
        }
      }
      // 将参数作为查询参数附加到URL上
      let httpurl = this.url.submit + '?orderId=' + encodeURIComponent(targetId)
      let method = 'get'
      var params = {}  // 清空params,因为参数已经在URL中传递
      const that = this
      this.$confirm({
        title: '确认提交!',
        // content: '正在提交数据,请耐心等待...',
        okText: '确认',
        cancelText: '取消',
        onOk() {
          // 显示加载提示
          const hide = that.$message.loading('正在提交数据,请耐心等待...', 0)
          // 发送请求
          return httpAction(httpurl, params, method).then((res) => {
            hide() // 隐藏加载提示
            if (res.success) {
              that.$message.success(res.message)
              that.loadData()
            } else {
              that.$message.warning(res.message)
            }
          }).catch(error => {
            hide() // 隐藏加载提示
            that.$message.error('提交失败: ' + error.message)
          }).finally(() => {
            that.loading = false
          })
        }
      })
    },
    customRow(record) {
      return {
        on: {
          click: (e) => {
@@ -266,13 +334,13 @@
            for (let i = 0; i < children.length; i++) {
              children[i].classList.add('checked-td-of-add-table')
            }
          },
        },
          }
        }
      }
    },
    }
  }
}
</script>
<style scoped>
  @import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>