lixiangyu
13 小时以前 81ab1c3f753f74f0324936d3d9fe2cb341945048
src/views/cms/CuttingToolList.vue
@@ -10,38 +10,23 @@
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
              <a-form-item label="刀具名称">
                <a-input placeholder="请输入刀具名称" v-model="queryParam.cuttingName" />
              </a-form-item>
            </a-col>
            <a-form-item label="刀具名称">
              <a-input placeholder="请输入刀具名称" v-model="queryParam.cuttingName" />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
              <a-form-item label="刀具分类">
                <j-search-select-tag
                  placeholder="请选择刀具分类"
                  v-model="queryParam.cuttingCategory"
                  dict="cutting_category"
                />
              </a-form-item>
            </a-col>
            <a-col
            :md="6"
            :sm="8"
          >
            <span
              style="float: left;overflow: hidden;"
              class="table-page-search-submitButtons"
            >
              <a-button
                type="primary"
                @click="searchQuery"
                icon="search"
              >查询</a-button>
              <a-button
                type="primary"
                @click="searchReset"
                icon="reload"
                style="margin-left: 8px"
              >重置</a-button>
            <a-form-item label="刀具分类">
              <j-search-select-tag
                placeholder="请选择刀具分类"
                v-model="queryParam.cuttingCategory"
                dict="cutting_category"
              />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <span style="float: left; overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
@@ -52,16 +37,23 @@
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <!-- <a-button type="primary" icon="download" @click="handleExportXls('刀具信息')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
      <a-button type="primary" icon="download" @click="handleExportXls('刀具信息')">导出</a-button>
      <a-upload
        name="file"
        :showUploadList="false"
        :multiple="false"
        :headers="tokenHeader"
        :action="importExcelUrl"
        @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload> -->
      </a-upload>
    </div>
    <!-- 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>
@@ -70,12 +62,12 @@
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :rowKey="record => record.id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
        class="j-table-force-nowrap"
        :customRow="customRow"
        @change="handleTableChange">
@@ -83,10 +75,19 @@
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </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>
          <a-button
@@ -102,7 +103,6 @@
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
@@ -118,165 +118,162 @@
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="扩展属性" key="1">
        <cutting-properties-list ref="cuttingPropertiesList"></cutting-properties-list>
      </a-tab-pane>
      <!-- <a-tab-pane tab="额定寿命" key="2">
        <rated-life-list ref="ratedLifeList"></rated-life-list>
      </a-tab-pane> -->
    </a-tabs>
    <!-- table区域-end -->
    <cutting-tool-modal ref="modalForm" @ok="modalFormOk"></cutting-tool-modal>
    <cutting-tool-modal ref="modalForm" @ok="handleOk"></cutting-tool-modal>
  </a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CuttingToolModal from './modules/CuttingToolModal'
import CuttingPropertiesList from './CuttingPropertiesList'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import CuttingToolModal from './modules/CuttingToolModal'
  import CuttingPropertiesList from './CuttingPropertiesList'
  import JDictSelectTag from '@/components/dict/JDictSelectTag'
  import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  export default {
    name: 'CuttingToolList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      CuttingToolModal,CuttingPropertiesList, JDictSelectTag,
export default {
  name: 'CuttingToolList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    CuttingToolModal,
    CuttingPropertiesList,
    JDictSelectTag,
    JSearchSelectTag
    },
    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: 'cuttingCode'
          },
          {
            title:'刀具名称',
            align:"center",
            dataIndex: 'cuttingName'
          },
          {
            title:'刀具分类',
            align:"center",
            dataIndex: 'cuttingCategory'
          },
          {
            title:'存放位置',
            align:"center",
            dataIndex: 'storeLocation'
          },
          {
            title:'供应商',
            align:"center",
            dataIndex: 'supplierId'
          },
          {
            title:'最小包装单位',
            align:"center",
            dataIndex: 'minimumPackageUnit'
          },
          {
            title:'刀具材质',
            align:"center",
            dataIndex: 'cuttingMaterial'
          },
          {
            title:'型号',
            align:"center",
            dataIndex: 'cuttingModel'
          },
          {
            title:'图号',
            align:"center",
            dataIndex: 'drawingNumber'
          },
          {
            title:'库存预警值',
            align:"center",
            dataIndex: 'inventoryWarning'
          },
          {
            title:'备注',
            align:"center",
            dataIndex: 'remark'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/cms/cuttingTool/getCuttingToolList",
          delete: "/cms/cuttingTool/delete",
          deleteBatch: "/cms/cuttingTool/deleteBatch",
          exportXlsUrl: "/cms/cuttingTool/exportXls",
          importExcelUrl: "cms/cuttingTool/importExcel",
  },
  data() {
    return {
      description: '刀具信息管理页面',
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: (t, r, index) => parseInt(index) + 1
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
        {
          title: '刀具编码',
          align: "center",
          dataIndex: 'cuttingCode'
        },
        {
          title: '刀具名称',
          align: "center",
          dataIndex: 'cuttingName'
        },
        {
          title: '刀具分类',
          align: "center",
          dataIndex: 'cuttingCategory'
        },
        {
          title: '存放位置',
          align: "center",
          dataIndex: 'storeLocation'
        },
        {
          title: '供应商',
          align: "center",
          dataIndex: 'supplierId'
        },
        {
          title: '最小包装单位',
          align: "center",
          dataIndex: 'minimumPackageUnit'
        },
        {
          title: '刀具材质',
          align: "center",
          dataIndex: 'cuttingMaterial'
        },
        {
          title: '型号',
          align: "center",
          dataIndex: 'cuttingModel'
        },
        {
          title: '图号',
          align: "center",
          dataIndex: 'drawingNumber'
        },
        {
          title: '库存预警值',
          align: "center",
          dataIndex: 'inventoryWarning'
        },
        {
          title: '备注',
          align: "center",
          dataIndex: 'remark'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          fixed: "right",
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/cms/cuttingTool/getCuttingToolList",
        delete: "/cms/cuttingTool/delete",
        deleteBatch: "/cms/cuttingTool/deleteBatch",
        exportXlsUrl: "/cms/cuttingTool/exportXls",
        importExcelUrl: "cms/cuttingTool/importExcel"
      },
    },
    methods: {
      customRow(record) {
        return {
      dictOptions: {},
      superFieldList: []
    }
  },
  computed: {
    importExcelUrl() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
  created() {
    this.getSuperFieldList();
  },
  methods: {
    customRow(record) {
      return {
        on: {
          click: e => {
            this.onSelectChange(record.id.split(","), [record]);
          click: () => {
            this.onSelectChange([record.id], [record]);
          }
        }
      };
      },
      onSelectChange(selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys;
      this.$refs.cuttingPropertiesList.getCuttingProperties(selectedRowKeys[0]);
    },
    handleEdit: function (record) {
        this.$refs.modalForm.edit(record)
        this.$refs.modalForm.title = '编辑'
        this.$refs.modalForm.disableSubmit = false
    onSelectChange(selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys;
      if (selectedRowKeys.length > 0) {
        this.$refs.cuttingPropertiesList.getCuttingProperties(selectedRowKeys[0]);
      }
    },
    handleEdit(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
      this.$refs.modalForm.add();
      this.$refs.modalForm.title = '新增';
      this.$refs.modalForm.disableSubmit = false;
    },
    handleDetail:function(record){
    handleDetail(record) {
      this.$refs.modalForm.edit(record);
      this.$refs.modalForm.title="详情";
      this.$refs.modalForm.title = "详情";
      this.$refs.modalForm.disableSubmit = true;
    },
    searchQuery() {
@@ -287,15 +284,24 @@
      this.loadData();
    },
    searchReset() {
      this.queryParam.cuttingCode = '';
      this.queryParam.cuttingName = '';
      this.queryParam.cuttingCategory = '';
      this.queryParam = {
        cuttingCode: '',
        cuttingName: '',
        cuttingCategory: ''
      };
      this.$refs.cuttingPropertiesList.getCuttingProperties("-1");
      this.loadData();
    },
    }
    handleOk() {
      // 新增/修改 成功时,重载列表
      this.loadData();
      //清空列表选中
      this.onClearSelected()
    },
  }
}
</script>
<style scoped>
  @import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>