| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <template>
- <div>
- <el-button type="primary" size="small" @click="onshow">{{
- $t(`全选并添加至本站`)
- }}</el-button>
- </div>
- </template>
- <script>
- export default {
- name: "selectAllAddToSite",
- props: ["where", "queryApiId", "basicLayout"],
- methods: {
- onshow() {
- this.onSelectAllAddToSite();
- },
- async onSelectAllAddToSite() {
- const elTable = this.basicLayout.$refs.table.$refs.tables;
- this.basicLayout.list.forEach((row) => {
- elTable.toggleRowSelection(row, true);
- });
- this.$confirm(
- this.$t("是否确定将全部物料添加至本站") + "?",
- this.$t("提示"),
- {
- confirmButtonText: this.$t("确定"),
- cancelButtonText: this.$t("取消"),
- type: "warning",
- }
- )
- .then(async () => {
- const queryRes = await this.$api.requested({
- id: this.queryApiId,
- content: {
- pageNumber: 1,
- pageSize: 99999,
- where: this.where,
- },
- });
- const ids = queryRes.data.map((item) => item.sc_itemid);
- const res = await this.$api.requested({
- id: 2026051511000002,
- content: {
- // sc_itemids: ids.join(","),不用传
- },
- });
- this.tool.showMessage(res, () => {
- this.$emit("addSuccess");
- });
- })
- .catch(async () => {
- elTable.clearSelection();
- this.$message({
- type: "info",
- message: this.$t("已取消全选并添加至本站"),
- });
- });
- },
- },
- };
- </script>
|